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

Commit 0eed51c4 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan Committed by Automerger Merge Worker
Browse files

Merge "Add total GPU usage report into dumpsys meminfo output" am: 50a824ab

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1472569

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4035733314612be05b5160655bb3e511cf8711e2
parents f75c4574 50a824ab
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -2575,6 +2575,13 @@ public final class Debug
     */
     */
    public static native long getIonMappedSizeKb();
    public static native long getIonMappedSizeKb();


    /**
     * Return memory size in kilobytes used by GPU.
     *
     * @hide
     */
    public static native long getGpuTotalUsageKb();

    /**
    /**
     * Return whether virtually-mapped kernel stacks are enabled (CONFIG_VMAP_STACK).
     * Return whether virtually-mapped kernel stacks are enabled (CONFIG_VMAP_STACK).
     * Note: caller needs config_gz read sepolicy permission
     * Note: caller needs config_gz read sepolicy permission
+13 −0
Original line number Original line Diff line number Diff line
@@ -844,6 +844,17 @@ static jlong android_os_Debug_getIonMappedSizeKb(JNIEnv* env, jobject clazz) {
    return ionPss;
    return ionPss;
}
}


static jlong android_os_Debug_getGpuTotalUsageKb(JNIEnv* env, jobject clazz) {
    jlong sizeKb = -1;
    uint64_t size;

    if (meminfo::ReadGpuTotalUsageKb(&size)) {
        sizeKb = size;
    }

    return sizeKb;
}

static jboolean android_os_Debug_isVmapStack(JNIEnv *env, jobject clazz)
static jboolean android_os_Debug_isVmapStack(JNIEnv *env, jobject clazz)
{
{
    static enum {
    static enum {
@@ -912,6 +923,8 @@ static const JNINativeMethod gMethods[] = {
            (void*)android_os_Debug_getIonPoolsSizeKb },
            (void*)android_os_Debug_getIonPoolsSizeKb },
    { "getIonMappedSizeKb", "()J",
    { "getIonMappedSizeKb", "()J",
            (void*)android_os_Debug_getIonMappedSizeKb },
            (void*)android_os_Debug_getIonMappedSizeKb },
    { "getGpuTotalUsageKb", "()J",
            (void*)android_os_Debug_getGpuTotalUsageKb },
    { "isVmapStack", "()Z",
    { "isVmapStack", "()Z",
            (void*)android_os_Debug_isVmapStack },
            (void*)android_os_Debug_isVmapStack },
};
};
+10 −0
Original line number Original line Diff line number Diff line
@@ -13744,6 +13744,10 @@ public class ActivityManagerService extends IActivityManager.Stub
                // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
                // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
                kernelUsed += ionHeap;
                kernelUsed += ionHeap;
            }
            }
            final long gpuUsage = Debug.getGpuTotalUsageKb();
            if (gpuUsage >= 0) {
                pw.print("      GPU: "); pw.println(stringifyKBSize(gpuUsage));
            }
            final long lostRAM = memInfo.getTotalSizeKb() - (totalPss - totalSwapPss)
            final long lostRAM = memInfo.getTotalSizeKb() - (totalPss - totalSwapPss)
                    - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
                    - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
                    - kernelUsed - memInfo.getZramTotalSizeKb();
                    - kernelUsed - memInfo.getZramTotalSizeKb();
@@ -14552,6 +14556,12 @@ public class ActivityManagerService extends IActivityManager.Stub
            // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
            // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
            kernelUsed += ionHeap;
            kernelUsed += ionHeap;
        }
        }
        final long gpuUsage = Debug.getGpuTotalUsageKb();
        if (gpuUsage >= 0) {
            memInfoBuilder.append("       GPU: ");
            memInfoBuilder.append(stringifyKBSize(gpuUsage));
            memInfoBuilder.append("\n");
        }
        memInfoBuilder.append("  Used RAM: ");
        memInfoBuilder.append("  Used RAM: ");
        memInfoBuilder.append(stringifyKBSize(
        memInfoBuilder.append(stringifyKBSize(
                                  totalPss - cachedPss + kernelUsed));
                                  totalPss - cachedPss + kernelUsed));