summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2021-02-04 15:55:02 -0800
committerHridya Valsaraju <hridya@google.com>2021-02-10 06:05:36 +0000
commit365ffff4b51ef2ed0a6a0f4f0baf32cc5f921ffe (patch)
treebb3840072f2f5ac943c83d4f33ee2c65d653fc43 /core
parent363d44d7a04ab4ab1a5c50fc0583cd5ff971ce2a (diff)
Add total DMA-BUF heap pool size information to dumpsys meminfo
Some DMA-BUF heaps maintain pools of pre-zeroed memory for faster allocations. Print the total size of all DMA-BUF heap pools as part of dumpsys meminfo and use the same in LostRam calculation. Test: dumpsys meminfo Bug: 167709539 Change-Id: Ifb61fe596c1a8fab1bd536ec904285e532629b71 Merged-In: Ifb61fe596c1a8fab1bd536ec904285e532629b71
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/Debug.java8
-rw-r--r--core/jni/android_os_Debug.cpp13
2 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 5b2bef31d1ed..c82149e390ba 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -2567,6 +2567,14 @@ public final class Debug
public static native long getIonHeapsSizeKb();
/**
+ * Return memory size in kilobytes allocated for DMA-BUF heap pools or -1 if
+ * /sys/kernel/dma_heap/total_pools_kb could not be read.
+ *
+ * @hide
+ */
+ public static native long getDmabufHeapPoolsSizeKb();
+
+ /**
* Return memory size in kilobytes allocated for ION pools or -1 if
* /sys/kernel/ion/total_pools_kb could not be read.
*
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index e0a3f2a398c7..2a93b4629e27 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -824,6 +824,17 @@ static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) {
return poolsSizeKb;
}
+static jlong android_os_Debug_getDmabufHeapPoolsSizeKb(JNIEnv* env, jobject clazz) {
+ jlong poolsSizeKb = -1;
+ uint64_t size;
+
+ if (meminfo::ReadDmabufHeapPoolsSizeKb(&size)) {
+ poolsSizeKb = size;
+ }
+
+ return poolsSizeKb;
+}
+
static jlong android_os_Debug_getDmabufMappedSizeKb(JNIEnv* env, jobject clazz) {
jlong dmabufPss = 0;
std::vector<dmabufinfo::DmaBuffer> dmabufs;
@@ -936,6 +947,8 @@ static const JNINativeMethod gMethods[] = {
(void*)android_os_Debug_getIonPoolsSizeKb },
{ "getDmabufMappedSizeKb", "()J",
(void*)android_os_Debug_getDmabufMappedSizeKb },
+ { "getDmabufHeapPoolsSizeKb", "()J",
+ (void*)android_os_Debug_getDmabufHeapPoolsSizeKb },
{ "getGpuTotalUsageKb", "()J",
(void*)android_os_Debug_getGpuTotalUsageKb },
{ "isVmapStack", "()Z",