Loading core/java/android/os/Debug.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -2565,6 +2565,14 @@ public final class Debug */ */ public static native long getDmabufTotalExportedKb(); 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 * Return memory size in kilobytes allocated for ION heaps or -1 if * /sys/kernel/ion/total_heaps_kb could not be read. * /sys/kernel/ion/total_heaps_kb could not be read. Loading core/jni/android_os_Debug.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -829,6 +829,16 @@ static jlong android_os_Debug_getDmabufTotalExportedKb(JNIEnv* env, jobject claz return dmabufTotalSizeKb; 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) { static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) { jlong poolsSizeKb = -1; jlong poolsSizeKb = -1; uint64_t size; uint64_t size; Loading Loading @@ -986,6 +996,8 @@ static const JNINativeMethod gMethods[] = { (void*)android_os_Debug_getDmabufTotalExportedKb }, (void*)android_os_Debug_getDmabufTotalExportedKb }, { "getGpuDmaBufUsageKb", "()J", { "getGpuDmaBufUsageKb", "()J", (void*)android_os_Debug_getGpuDmaBufUsageKb }, (void*)android_os_Debug_getGpuDmaBufUsageKb }, { "getDmabufHeapTotalExportedKb", "()J", (void*)android_os_Debug_getDmabufHeapTotalExportedKb }, { "getIonPoolsSizeKb", "()J", { "getIonPoolsSizeKb", "()J", (void*)android_os_Debug_getIonPoolsSizeKb }, (void*)android_os_Debug_getIonPoolsSizeKb }, { "getDmabufMappedSizeKb", "()J", { "getDmabufMappedSizeKb", "()J", Loading services/core/java/com/android/server/am/ActivityManagerService.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -10747,6 +10747,15 @@ public class ActivityManagerService extends IActivityManager.Stub ss[INDEX_TOTAL_PSS] -= ss[INDEX_TOTAL_MEMTRACK_GRAPHICS]; ss[INDEX_TOTAL_PSS] -= ss[INDEX_TOTAL_MEMTRACK_GRAPHICS]; ss[INDEX_TOTAL_PSS] += dmabufMapped; ss[INDEX_TOTAL_PSS] += dmabufMapped; } } // totalDmabufHeapExported is included in totalExportedDmabuf above and hence do not // need to be added to kernelUsed. final long totalDmabufHeapExported = Debug.getDmabufHeapTotalExportedKb(); if (totalDmabufHeapExported >= 0) { pw.print("DMA-BUF Heaps: "); pw.println(stringifyKBSize(totalDmabufHeapExported)); } final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); if (totalDmabufHeapPool >= 0) { if (totalDmabufHeapPool >= 0) { pw.print("DMA-BUF Heaps pool: "); pw.print("DMA-BUF Heaps pool: "); Loading services/core/java/com/android/server/am/AppProfiler.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1536,6 +1536,14 @@ public class AppProfiler { totalPss -= totalMemtrackGraphics; totalPss -= totalMemtrackGraphics; totalPss += dmabufMapped; totalPss += dmabufMapped; } } // These are included in the totalExportedDmabuf above and hence do not need to be added // to kernelUsed. final long totalExportedDmabufHeap = Debug.getDmabufHeapTotalExportedKb(); if (totalExportedDmabufHeap >= 0) { memInfoBuilder.append("DMA-BUF Heap: "); memInfoBuilder.append(stringifyKBSize(totalExportedDmabufHeap)); memInfoBuilder.append("\n"); } final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); if (totalDmabufHeapPool >= 0) { if (totalDmabufHeapPool >= 0) { Loading Loading
core/java/android/os/Debug.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -2565,6 +2565,14 @@ public final class Debug */ */ public static native long getDmabufTotalExportedKb(); 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 * Return memory size in kilobytes allocated for ION heaps or -1 if * /sys/kernel/ion/total_heaps_kb could not be read. * /sys/kernel/ion/total_heaps_kb could not be read. Loading
core/jni/android_os_Debug.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -829,6 +829,16 @@ static jlong android_os_Debug_getDmabufTotalExportedKb(JNIEnv* env, jobject claz return dmabufTotalSizeKb; 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) { static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) { jlong poolsSizeKb = -1; jlong poolsSizeKb = -1; uint64_t size; uint64_t size; Loading Loading @@ -986,6 +996,8 @@ static const JNINativeMethod gMethods[] = { (void*)android_os_Debug_getDmabufTotalExportedKb }, (void*)android_os_Debug_getDmabufTotalExportedKb }, { "getGpuDmaBufUsageKb", "()J", { "getGpuDmaBufUsageKb", "()J", (void*)android_os_Debug_getGpuDmaBufUsageKb }, (void*)android_os_Debug_getGpuDmaBufUsageKb }, { "getDmabufHeapTotalExportedKb", "()J", (void*)android_os_Debug_getDmabufHeapTotalExportedKb }, { "getIonPoolsSizeKb", "()J", { "getIonPoolsSizeKb", "()J", (void*)android_os_Debug_getIonPoolsSizeKb }, (void*)android_os_Debug_getIonPoolsSizeKb }, { "getDmabufMappedSizeKb", "()J", { "getDmabufMappedSizeKb", "()J", Loading
services/core/java/com/android/server/am/ActivityManagerService.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -10747,6 +10747,15 @@ public class ActivityManagerService extends IActivityManager.Stub ss[INDEX_TOTAL_PSS] -= ss[INDEX_TOTAL_MEMTRACK_GRAPHICS]; ss[INDEX_TOTAL_PSS] -= ss[INDEX_TOTAL_MEMTRACK_GRAPHICS]; ss[INDEX_TOTAL_PSS] += dmabufMapped; ss[INDEX_TOTAL_PSS] += dmabufMapped; } } // totalDmabufHeapExported is included in totalExportedDmabuf above and hence do not // need to be added to kernelUsed. final long totalDmabufHeapExported = Debug.getDmabufHeapTotalExportedKb(); if (totalDmabufHeapExported >= 0) { pw.print("DMA-BUF Heaps: "); pw.println(stringifyKBSize(totalDmabufHeapExported)); } final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); if (totalDmabufHeapPool >= 0) { if (totalDmabufHeapPool >= 0) { pw.print("DMA-BUF Heaps pool: "); pw.print("DMA-BUF Heaps pool: "); Loading
services/core/java/com/android/server/am/AppProfiler.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1536,6 +1536,14 @@ public class AppProfiler { totalPss -= totalMemtrackGraphics; totalPss -= totalMemtrackGraphics; totalPss += dmabufMapped; totalPss += dmabufMapped; } } // These are included in the totalExportedDmabuf above and hence do not need to be added // to kernelUsed. final long totalExportedDmabufHeap = Debug.getDmabufHeapTotalExportedKb(); if (totalExportedDmabufHeap >= 0) { memInfoBuilder.append("DMA-BUF Heap: "); memInfoBuilder.append(stringifyKBSize(totalExportedDmabufHeap)); memInfoBuilder.append("\n"); } final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); final long totalDmabufHeapPool = Debug.getDmabufHeapPoolsSizeKb(); if (totalDmabufHeapPool >= 0) { if (totalDmabufHeapPool >= 0) { Loading