Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ae0be89 authored by Hridya Valsaraju's avatar Hridya Valsaraju
Browse files

Rename getIonMappedSizeKb to getDmabufMappedSizeKb

The function is actually calculating the total mapped DMA-BUF memory.

Test: dumpsys meminfo
Bug: 167709539
Change-Id: I5c19dc604cf48c3d7ccbfd2d9a83ddd7b35f20d5
Merged-In: I5c19dc604cf48c3d7ccbfd2d9a83ddd7b35f20d5
parent de246e16
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2567,13 +2567,13 @@ public final class Debug
    public static native long getIonPoolsSizeKb();

    /**
     * Return ION memory mapped by processes in kB.
     * Return DMA-BUF memory mapped by processes in kB.
     * Notes:
     *  * Warning: Might impact performance as it reads /proc/<pid>/maps files for each process.
     *
     * @hide
     */
    public static native long getIonMappedSizeKb();
    public static native long getDmabufMappedSizeKb();

    /**
     * Return memory size in kilobytes used by GPU.
+6 −6
Original line number Diff line number Diff line
@@ -813,8 +813,8 @@ static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) {
    return poolsSizeKb;
}

static jlong android_os_Debug_getIonMappedSizeKb(JNIEnv* env, jobject clazz) {
    jlong ionPss = 0;
static jlong android_os_Debug_getDmabufMappedSizeKb(JNIEnv* env, jobject clazz) {
    jlong dmabufPss = 0;
    std::vector<dmabufinfo::DmaBuffer> dmabufs;

    std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir("/proc"), closedir);
@@ -838,10 +838,10 @@ static jlong android_os_Debug_getIonMappedSizeKb(JNIEnv* env, jobject clazz) {
    }

    for (const dmabufinfo::DmaBuffer& buf : dmabufs) {
        ionPss += buf.size() / 1024;
        dmabufPss += buf.size() / 1024;
    }

    return ionPss;
    return dmabufPss;
}

static jlong android_os_Debug_getGpuTotalUsageKb(JNIEnv* env, jobject clazz) {
@@ -921,8 +921,8 @@ static const JNINativeMethod gMethods[] = {
            (void*)android_os_Debug_getIonHeapsSizeKb },
    { "getIonPoolsSizeKb", "()J",
            (void*)android_os_Debug_getIonPoolsSizeKb },
    { "getIonMappedSizeKb", "()J",
            (void*)android_os_Debug_getIonMappedSizeKb },
    { "getDmabufMappedSizeKb", "()J",
            (void*)android_os_Debug_getDmabufMappedSizeKb },
    { "getGpuTotalUsageKb", "()J",
            (void*)android_os_Debug_getGpuTotalUsageKb },
    { "isVmapStack", "()Z",
+2 −2
Original line number Diff line number Diff line
@@ -13731,7 +13731,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            final long ionHeap = Debug.getIonHeapsSizeKb();
            final long ionPool = Debug.getIonPoolsSizeKb();
            if (ionHeap >= 0 && ionPool >= 0) {
                final long ionMapped = Debug.getIonMappedSizeKb();
                final long ionMapped = Debug.getDmabufMappedSizeKb();
                final long ionUnmapped = ionHeap - ionMapped;
                pw.print("      ION: ");
                        pw.print(stringifyKBSize(ionHeap + ionPool));
@@ -14549,7 +14549,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        final long ionHeap = Debug.getIonHeapsSizeKb();
        final long ionPool = Debug.getIonPoolsSizeKb();
        if (ionHeap >= 0 && ionPool >= 0) {
            final long ionMapped = Debug.getIonMappedSizeKb();
            final long ionMapped = Debug.getDmabufMappedSizeKb();
            final long ionUnmapped = ionHeap - ionMapped;
            memInfoBuilder.append("       ION: ");
            memInfoBuilder.append(stringifyKBSize(ionHeap + ionPool));