summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/Debug.java10
-rw-r--r--core/java/com/android/internal/util/MemInfoReader.java49
2 files changed, 46 insertions, 13 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 18730b65a7dd..084ca30e263c 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -1093,7 +1093,15 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo
/** @hide */
public static final int MEMINFO_ZRAM_TOTAL = 8;
/** @hide */
- public static final int MEMINFO_COUNT = 9;
+ public static final int MEMINFO_MAPPED = 9;
+ /** @hide */
+ public static final int MEMINFO_VM_ALLOC_USED = 10;
+ /** @hide */
+ public static final int MEMINFO_PAGE_TABLES = 11;
+ /** @hide */
+ public static final int MEMINFO_KERNEL_STACK = 12;
+ /** @hide */
+ public static final int MEMINFO_COUNT = 13;
/**
* Retrieves /proc/meminfo. outSizes is filled with fields
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index 5f240f73b5be..1dd946494d4d 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -34,40 +34,65 @@ public final class MemInfoReader {
}
}
+ /**
+ * Total amount of RAM available to the kernel.
+ */
public long getTotalSize() {
return mInfos[Debug.MEMINFO_TOTAL] * 1024;
}
+ /**
+ * Amount of RAM that is not being used for anything.
+ */
public long getFreeSize() {
return mInfos[Debug.MEMINFO_FREE] * 1024;
}
+ /**
+ * Amount of RAM that the kernel is being used for caches, not counting caches
+ * that are mapped in to processes.
+ */
public long getCachedSize() {
- return mInfos[Debug.MEMINFO_CACHED] * 1024;
+ return getCachedSizeKb() * 1024;
}
+ /**
+ * Amount of RAM that is in use by the kernel for actual allocations.
+ */
+ public long getKernelUsedSize() {
+ return getKernelUsedSizeKb() * 1024;
+ }
+
+ /**
+ * Total amount of RAM available to the kernel.
+ */
public long getTotalSizeKb() {
return mInfos[Debug.MEMINFO_TOTAL];
}
+ /**
+ * Amount of RAM that is not being used for anything.
+ */
public long getFreeSizeKb() {
return mInfos[Debug.MEMINFO_FREE];
}
+ /**
+ * Amount of RAM that the kernel is being used for caches, not counting caches
+ * that are mapped in to processes.
+ */
public long getCachedSizeKb() {
- return mInfos[Debug.MEMINFO_CACHED];
- }
-
- public long getBuffersSizeKb() {
- return mInfos[Debug.MEMINFO_BUFFERS];
- }
-
- public long getShmemSizeKb() {
- return mInfos[Debug.MEMINFO_SHMEM];
+ return mInfos[Debug.MEMINFO_BUFFERS]
+ + mInfos[Debug.MEMINFO_CACHED] - mInfos[Debug.MEMINFO_MAPPED];
}
- public long getSlabSizeKb() {
- return mInfos[Debug.MEMINFO_SLAB];
+ /**
+ * Amount of RAM that is in use by the kernel for actual allocations.
+ */
+ public long getKernelUsedSizeKb() {
+ 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 getSwapTotalSizeKb() {