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

Commit 15216a59 authored by Richard Uhler's avatar Richard Uhler
Browse files

Add Java heap metrics to PostGCMemorySnapshot.

Bug: 380109490
Test: Manually inspect data logged via Atom Tester.
Flag: EXEMPT atoms/metrics change.
Change-Id: I3039f3c1f72e7eb230eef7e175b99b307bb37c0a
parent 4c269cdc
Loading
Loading
Loading
Loading
+19 −14
Original line number Diff line number Diff line
@@ -16,16 +16,17 @@

package com.android.internal.os.logging;

import android.app.Application;
import android.os.Process;
import android.util.Log;
import android.view.WindowManager.LayoutParams;

import com.android.internal.os.ProcfsMemoryUtil;
import com.android.internal.util.FrameworkStatsLog;
import java.util.Collection;

import libcore.util.NativeAllocationRegistry;

import java.util.Collection;


/**
 * Used to wrap different logging calls in one, so that client side code base is clean and more
 * readable.
@@ -84,6 +85,7 @@ public class MetricsLoggerWrapper {

        ProcfsMemoryUtil.MemorySnapshot m = ProcfsMemoryUtil.readMemorySnapshotFromProcfs();
        int oom_score_adj = ProcfsMemoryUtil.readOomScoreAdjFromProcfs();
        Runtime runtime = Runtime.getRuntime();
        FrameworkStatsLog.write(FrameworkStatsLog.POSTGC_MEMORY_SNAPSHOT,
                m.uid, processName, pid,
                oom_score_adj,
@@ -95,6 +97,9 @@ public class MetricsLoggerWrapper {
                mallocedCount,
                mallocedBytes,
                nonmallocedCount,
            nonmallocedBytes);
                nonmallocedBytes,
                runtime.freeMemory(),
                runtime.totalMemory(),
                runtime.maxMemory());
    }
}