summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-02-16 17:58:25 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-02-16 17:58:25 +0000
commit2a2456d3a41109c7ec9376c56ed0c61f284c6b1f (patch)
tree2403b60def4ac0467977b047cb528fab62b0b3fa /core
parent6d3bd2dca6fa62cccca67daefd80d7d57e9f069e (diff)
parent1ff4e91e6ce051a759ec920d141303284c289020 (diff)
Merge "dumpsys: Print total DMA-BUFs exported from the DMA-BUF heaps framework"
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/Debug.java8
-rw-r--r--core/jni/android_os_Debug.cpp12
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index ea282afb8b8e..903bea3dc2ce 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -2560,6 +2560,14 @@ public final class Debug
public static native long getDmabufTotalExportedKb();
/**
+ * Return total memory size in kilobytes for DMA-BUFs exported from the DMA-BUF
+ * heaps frameworks or -1 in the case of an error.
+ *
+ * @hide
+ */
+ public static native long getDmabufHeapTotalExportedKb();
+
+ /**
* Return memory size in kilobytes allocated for ION heaps or -1 if
* /sys/kernel/ion/total_heaps_kb could not be read.
*
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 223b4dcc0549..0e3db46bd0c9 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -826,6 +826,16 @@ static jlong android_os_Debug_getDmabufTotalExportedKb(JNIEnv* env, jobject claz
return dmabufTotalSizeKb;
}
+static jlong android_os_Debug_getDmabufHeapTotalExportedKb(JNIEnv* env, jobject clazz) {
+ jlong dmabufHeapTotalSizeKb = -1;
+ uint64_t size;
+
+ if (meminfo::ReadDmabufHeapTotalExportedKb(&size)) {
+ dmabufHeapTotalSizeKb = size;
+ }
+ return dmabufHeapTotalSizeKb;
+}
+
static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) {
jlong poolsSizeKb = -1;
uint64_t size;
@@ -983,6 +993,8 @@ static const JNINativeMethod gMethods[] = {
(void*)android_os_Debug_getDmabufTotalExportedKb },
{ "getGpuDmaBufUsageKb", "()J",
(void*)android_os_Debug_getGpuDmaBufUsageKb },
+ { "getDmabufHeapTotalExportedKb", "()J",
+ (void*)android_os_Debug_getDmabufHeapTotalExportedKb },
{ "getIonPoolsSizeKb", "()J",
(void*)android_os_Debug_getIonPoolsSizeKb },
{ "getDmabufMappedSizeKb", "()J",