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

Commit 9e04cb3c authored by Kevin Jeon's avatar Kevin Jeon
Browse files

Add additional meminfo fields to SystemMemory

This change adds 13 additional fields from /proc/meminfo to the
SystemMemory atom (MemTotal, MemFree, MemAvailable, Active, Inactive,
Active(anon), Inactive(anon), Active(file), Inactive(file), SwapTotal,
SwapFree, CmaTotal, CmaFree). This is intended to provide a view of
overall system memory usage.

7 of these fields were newly added to the Debug class.

Test: statsd_testdrive 10092; verify that new fields are populated.
Bug: 260245141
Change-Id: I2da2732a6f6153e67a03d8b2f616627ca13935c7
parent 0aa22095
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -1956,7 +1956,21 @@ public final class Debug
    /** @hide */
    public static final int MEMINFO_UNEVICTABLE = 18;
    /** @hide */
    public static final int MEMINFO_COUNT = 19;
    public static final int MEMINFO_AVAILABLE = 19;
    /** @hide */
    public static final int MEMINFO_ACTIVE_ANON = 20;
    /** @hide */
    public static final int MEMINFO_INACTIVE_ANON = 21;
    /** @hide */
    public static final int MEMINFO_ACTIVE_FILE = 22;
    /** @hide */
    public static final int MEMINFO_INACTIVE_FILE = 23;
    /** @hide */
    public static final int MEMINFO_CMA_TOTAL = 24;
    /** @hide */
    public static final int MEMINFO_CMA_FREE = 25;
    /** @hide */
    public static final int MEMINFO_COUNT = 26;

    /**
     * Retrieves /proc/meminfo.  outSizes is filled with fields
+7 −0
Original line number Diff line number Diff line
@@ -587,6 +587,13 @@ enum {
    MEMINFO_ACTIVE,
    MEMINFO_INACTIVE,
    MEMINFO_UNEVICTABLE,
    MEMINFO_AVAILABLE,
    MEMINFO_ACTIVE_ANON,
    MEMINFO_INACTIVE_ANON,
    MEMINFO_ACTIVE_FILE,
    MEMINFO_INACTIVE_FILE,
    MEMINFO_CMA_TOTAL,
    MEMINFO_CMA_FREE,
    MEMINFO_COUNT
};

+14 −1
Original line number Diff line number Diff line
@@ -2408,7 +2408,20 @@ public class StatsPullAtomService extends SystemService {
                        metrics.gpuTotalUsageKb,
                        metrics.gpuPrivateAllocationsKb,
                        metrics.dmaBufTotalExportedKb,
                        metrics.shmemKb));
                        metrics.shmemKb,
                        metrics.totalKb,
                        metrics.freeKb,
                        metrics.availableKb,
                        metrics.activeKb,
                        metrics.inactiveKb,
                        metrics.activeAnonKb,
                        metrics.inactiveAnonKb,
                        metrics.activeFileKb,
                        metrics.inactiveFileKb,
                        metrics.swapTotalKb,
                        metrics.swapFreeKb,
                        metrics.cmaTotalKb,
                        metrics.cmaFreeKb));
        return StatsManager.PULL_SUCCESS;
    }

+26 −0
Original line number Diff line number Diff line
@@ -83,6 +83,19 @@ final class SystemMemoryUtil {
        result.pageTablesKb = (int) mInfos[Debug.MEMINFO_PAGE_TABLES];
        result.kernelStackKb = (int) mInfos[Debug.MEMINFO_KERNEL_STACK];
        result.shmemKb = (int) mInfos[Debug.MEMINFO_SHMEM];
        result.totalKb = (int) mInfos[Debug.MEMINFO_TOTAL];
        result.freeKb = (int) mInfos[Debug.MEMINFO_FREE];
        result.availableKb = (int) mInfos[Debug.MEMINFO_AVAILABLE];
        result.activeKb = (int) mInfos[Debug.MEMINFO_ACTIVE];
        result.inactiveKb = (int) mInfos[Debug.MEMINFO_INACTIVE];
        result.activeAnonKb = (int) mInfos[Debug.MEMINFO_ACTIVE_ANON];
        result.inactiveAnonKb = (int) mInfos[Debug.MEMINFO_INACTIVE_ANON];
        result.activeFileKb = (int) mInfos[Debug.MEMINFO_ACTIVE_FILE];
        result.inactiveFileKb = (int) mInfos[Debug.MEMINFO_INACTIVE_FILE];
        result.swapTotalKb = (int) mInfos[Debug.MEMINFO_SWAP_TOTAL];
        result.swapFreeKb = (int) mInfos[Debug.MEMINFO_SWAP_FREE];
        result.cmaTotalKb = (int) mInfos[Debug.MEMINFO_CMA_TOTAL];
        result.cmaFreeKb = (int) mInfos[Debug.MEMINFO_CMA_FREE];
        result.totalIonKb = totalIonKb;
        result.gpuTotalUsageKb = gpuTotalUsageKb;
        result.gpuPrivateAllocationsKb = gpuPrivateAllocationsKb;
@@ -97,6 +110,19 @@ final class SystemMemoryUtil {
        public int pageTablesKb;
        public int kernelStackKb;
        public int shmemKb;
        public int totalKb;
        public int freeKb;
        public int availableKb;
        public int activeKb;
        public int inactiveKb;
        public int activeAnonKb;
        public int inactiveAnonKb;
        public int activeFileKb;
        public int inactiveFileKb;
        public int swapTotalKb;
        public int swapFreeKb;
        public int cmaTotalKb;
        public int cmaFreeKb;
        public int totalIonKb;
        public int gpuTotalUsageKb;
        public int gpuPrivateAllocationsKb;