FileDocCategorySizeDatePackage
MemInfoReader.javaAPI DocAndroid 5.1 API3281Thu Mar 12 22:22:10 GMT 2015com.android.internal.util

MemInfoReader

public final class MemInfoReader extends Object

Fields Summary
final long[]
mInfos
Constructors Summary
Methods Summary
public longgetCachedSize()
Amount of RAM that the kernel is being used for caches, not counting caches that are mapped in to processes.

        return getCachedSizeKb() * 1024;
    
public longgetCachedSizeKb()
Amount of RAM that the kernel is being used for caches, not counting caches that are mapped in to processes.

        return mInfos[Debug.MEMINFO_BUFFERS]
                + mInfos[Debug.MEMINFO_CACHED] - mInfos[Debug.MEMINFO_MAPPED];
    
public longgetFreeSize()
Amount of RAM that is not being used for anything.

        return mInfos[Debug.MEMINFO_FREE] * 1024;
    
public longgetFreeSizeKb()
Amount of RAM that is not being used for anything.

        return mInfos[Debug.MEMINFO_FREE];
    
public longgetKernelUsedSize()
Amount of RAM that is in use by the kernel for actual allocations.

        return getKernelUsedSizeKb() * 1024;
    
public longgetKernelUsedSizeKb()
Amount of RAM that is in use by the kernel for actual allocations.

        return mInfos[Debug.MEMINFO_SHMEM] + mInfos[Debug.MEMINFO_SLAB]
                + mInfos[Debug.MEMINFO_VM_ALLOC_USED] + mInfos[Debug.MEMINFO_PAGE_TABLES]
                + mInfos[Debug.MEMINFO_KERNEL_STACK];
    
public long[]getRawInfo()

        return mInfos;
    
public longgetSwapFreeSizeKb()

        return mInfos[Debug.MEMINFO_SWAP_FREE];
    
public longgetSwapTotalSizeKb()

        return mInfos[Debug.MEMINFO_SWAP_TOTAL];
    
public longgetTotalSize()
Total amount of RAM available to the kernel.

        return mInfos[Debug.MEMINFO_TOTAL] * 1024;
    
public longgetTotalSizeKb()
Total amount of RAM available to the kernel.

        return mInfos[Debug.MEMINFO_TOTAL];
    
public longgetZramTotalSizeKb()

        return mInfos[Debug.MEMINFO_ZRAM_TOTAL];
    
public voidreadMemInfo()


       
        // Permit disk reads here, as /proc/meminfo isn't really "on
        // disk" and should be fast.  TODO: make BlockGuard ignore
        // /proc/ and /sys/ files perhaps?
        StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
        try {
            Debug.getMemInfo(mInfos);
        } finally {
            StrictMode.setThreadPolicy(savedPolicy);
        }