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

Commit 1a5da049 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Record memory data in event log as we collect it for procstats.

Change-Id: I37d6d87aac0c400ea402ae20e6174fd851d3c1f9
parent e322d125
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -1854,9 +1854,14 @@ public final class ActivityManagerService extends ActivityManagerNative
                    synchronized (ActivityManagerService.this) {
                        if (DEBUG_PSS) Slog.d(TAG, "Collected native and kernel memory in "
                                + (SystemClock.uptimeMillis()-start) + "ms");
                        mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(),
                                memInfo.getFreeSizeKb(), memInfo.getZramTotalSizeKb(),
                                memInfo.getKernelUsedSizeKb(), nativeTotalPss);
                        final long cachedKb = memInfo.getCachedSizeKb();
                        final long freeKb = memInfo.getFreeSizeKb();
                        final long zramKb = memInfo.getZramTotalSizeKb();
                        final long kernelKb = memInfo.getKernelUsedSizeKb();
                        EventLogTags.writeAmMeminfo(cachedKb*1024, freeKb*1024, zramKb*1024,
                                kernelKb*1024, nativeTotalPss*1024);
                        mProcessStats.addSysMemUsageLocked(cachedKb, freeKb, zramKb, kernelKb,
                                nativeTotalPss);
                    }
                }
@@ -13902,9 +13907,14 @@ public final class ActivityManagerService extends ActivityManagerNative
            memInfo.readMemInfo();
            if (nativeProcTotalPss > 0) {
                synchronized (this) {
                    mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(),
                            memInfo.getFreeSizeKb(), memInfo.getZramTotalSizeKb(),
                            memInfo.getKernelUsedSizeKb(), nativeProcTotalPss);
                    final long cachedKb = memInfo.getCachedSizeKb();
                    final long freeKb = memInfo.getFreeSizeKb();
                    final long zramKb = memInfo.getZramTotalSizeKb();
                    final long kernelKb = memInfo.getKernelUsedSizeKb();
                    EventLogTags.writeAmMeminfo(cachedKb*1024, freeKb*1024, zramKb*1024,
                            kernelKb*1024, nativeProcTotalPss*1024);
                    mProcessStats.addSysMemUsageLocked(cachedKb, freeKb, zramKb, kernelKb,
                            nativeProcTotalPss);
                }
            }
            if (!brief) {
@@ -17098,6 +17108,7 @@ public final class ActivityManagerService extends ActivityManagerNative
     * Record new PSS sample for a process.
     */
    void recordPssSample(ProcessRecord proc, int procState, long pss, long uss, long now) {
        EventLogTags.writeAmPss(proc.pid, proc.uid, proc.processName, pss*1024, uss*1024);
        proc.lastPssTime = now;
        proc.baseProcessTracker.addPss(pss, uss, true, proc.pkgList);
        if (DEBUG_PSS) Slog.d(TAG, "PSS of " + proc.toShortString()
+5 −0
Original line number Diff line number Diff line
@@ -98,3 +98,8 @@ option java_package com.android.server.am

# Running pre boot receiver
30045 am_pre_boot (User|1|5),(Package|3)

# Report collection of global memory state
30046 am_meminfo (CachedKb|2|2),(FreeKb|2|2),(ZramKb|2|2),(KernelKb|2|2),(NativeKb|2|2)
# Report collection of memory used by a process
30047 am_pss (Pid|1|5),(UID|1|5),(Process Name|3),(PssKb|2|2),(UssKb|2|2)