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

Commit 61ac2089 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 8ad868b5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2573,13 +2573,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
@@ -816,8 +816,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);
@@ -841,10 +841,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) {
@@ -924,8 +924,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",
+1 −1
Original line number Diff line number Diff line
@@ -10701,7 +10701,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));
+1 −1
Original line number Diff line number Diff line
@@ -1512,7 +1512,7 @@ public class AppProfiler {
        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));