Loading cmds/statsd/src/atoms.proto +18 −15 Original line number Diff line number Diff line Loading @@ -2420,9 +2420,12 @@ message NativeProcessMemoryState { optional int64 rss_in_bytes = 5; // RSS high watermark. // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups. // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status. optional int64 rss_high_watermark_in_bytes = 6; // Elapsed real time when the process started. // Value is read from /proc/PID/stat, field 22. optional int64 start_time_nanos = 7; } /* Loading cmds/statsd/src/external/StatsPullerManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}}, // native_process_memory_state {android::util::NATIVE_PROCESS_MEMORY_STATE, {{3, 4, 5, 6}, {{3, 4, 5, 6, 7}, {2}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::NATIVE_PROCESS_MEMORY_STATE)}}, Loading core/java/android/app/ProcessMemoryState.java +5 −1 Original line number Diff line number Diff line Loading @@ -33,10 +33,11 @@ public final class ProcessMemoryState implements Parcelable { public final long cacheInBytes; public final long swapInBytes; public final long rssHighWatermarkInBytes; public final long startTimeNanos; public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault, long pgmajfault, long rssInBytes, long cacheInBytes, long swapInBytes, long rssHighWatermarkInBytes) { long swapInBytes, long rssHighWatermarkInBytes, long startTimeNanos) { this.uid = uid; this.processName = processName; this.oomScore = oomScore; Loading @@ -46,6 +47,7 @@ public final class ProcessMemoryState implements Parcelable { this.cacheInBytes = cacheInBytes; this.swapInBytes = swapInBytes; this.rssHighWatermarkInBytes = rssHighWatermarkInBytes; this.startTimeNanos = startTimeNanos; } private ProcessMemoryState(Parcel in) { Loading @@ -58,6 +60,7 @@ public final class ProcessMemoryState implements Parcelable { cacheInBytes = in.readLong(); swapInBytes = in.readLong(); rssHighWatermarkInBytes = in.readLong(); startTimeNanos = in.readLong(); } public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() { Loading Loading @@ -88,5 +91,6 @@ public final class ProcessMemoryState implements Parcelable { parcel.writeLong(cacheInBytes); parcel.writeLong(swapInBytes); parcel.writeLong(rssHighWatermarkInBytes); parcel.writeLong(startTimeNanos); } } services/core/java/com/android/server/am/ActivityManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -18620,7 +18620,8 @@ public class ActivityManagerService extends IActivityManager.Stub memoryStat.rssInBytes, memoryStat.cacheInBytes, memoryStat.swapInBytes, memoryStat.rssHighWatermarkInBytes); memoryStat.rssHighWatermarkInBytes, memoryStat.startTimeNanos); processMemoryStates.add(processMemoryState); } } Loading @@ -18643,7 +18644,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessMemoryState processMemoryState = new ProcessMemoryState(uid, processName, oomScore, memoryStat.pgfault, memoryStat.pgmajfault, memoryStat.rssInBytes, memoryStat.cacheInBytes, memoryStat.swapInBytes, memoryStat.rssHighWatermarkInBytes); memoryStat.rssHighWatermarkInBytes, memoryStat.startTimeNanos); processMemoryStates.add(processMemoryState); } return processMemoryStates; services/core/java/com/android/server/am/MemoryStatUtil.java +7 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NA import android.annotation.Nullable; import android.os.FileUtils; import android.os.SystemProperties; import android.system.Os; import android.system.OsConstants; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -71,6 +73,7 @@ public final class MemoryStatUtil { static final int BYTES_IN_KILOBYTE = 1024; static final int PAGE_SIZE = 4096; static final long JIFFY_NANOS = 1_000_000_000 / Os.sysconf(OsConstants._SC_CLK_TCK); private static final String TAG = TAG_WITH_CLASS_NAME ? "MemoryStatUtil" : TAG_AM; Loading Loading @@ -103,6 +106,7 @@ public final class MemoryStatUtil { private static final int PGFAULT_INDEX = 9; private static final int PGMAJFAULT_INDEX = 11; private static final int START_TIME_INDEX = 21; private static final int RSS_IN_PAGES_INDEX = 23; private MemoryStatUtil() {} Loading Loading @@ -238,6 +242,7 @@ public final class MemoryStatUtil { memoryStat.pgfault = Long.parseLong(splits[PGFAULT_INDEX]); memoryStat.pgmajfault = Long.parseLong(splits[PGMAJFAULT_INDEX]); memoryStat.rssInBytes = Long.parseLong(splits[RSS_IN_PAGES_INDEX]) * PAGE_SIZE; memoryStat.startTimeNanos = Long.parseLong(splits[START_TIME_INDEX]) * JIFFY_NANOS; return memoryStat; } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse value", e); Loading Loading @@ -279,5 +284,7 @@ public final class MemoryStatUtil { long swapInBytes; /** Number of bytes of peak anonymous and swap cache memory */ long rssHighWatermarkInBytes; /** Device time when the processes started. */ long startTimeNanos; } } Loading
cmds/statsd/src/atoms.proto +18 −15 Original line number Diff line number Diff line Loading @@ -2420,9 +2420,12 @@ message NativeProcessMemoryState { optional int64 rss_in_bytes = 5; // RSS high watermark. // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups. // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status. optional int64 rss_high_watermark_in_bytes = 6; // Elapsed real time when the process started. // Value is read from /proc/PID/stat, field 22. optional int64 start_time_nanos = 7; } /* Loading
cmds/statsd/src/external/StatsPullerManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}}, // native_process_memory_state {android::util::NATIVE_PROCESS_MEMORY_STATE, {{3, 4, 5, 6}, {{3, 4, 5, 6, 7}, {2}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::NATIVE_PROCESS_MEMORY_STATE)}}, Loading
core/java/android/app/ProcessMemoryState.java +5 −1 Original line number Diff line number Diff line Loading @@ -33,10 +33,11 @@ public final class ProcessMemoryState implements Parcelable { public final long cacheInBytes; public final long swapInBytes; public final long rssHighWatermarkInBytes; public final long startTimeNanos; public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault, long pgmajfault, long rssInBytes, long cacheInBytes, long swapInBytes, long rssHighWatermarkInBytes) { long swapInBytes, long rssHighWatermarkInBytes, long startTimeNanos) { this.uid = uid; this.processName = processName; this.oomScore = oomScore; Loading @@ -46,6 +47,7 @@ public final class ProcessMemoryState implements Parcelable { this.cacheInBytes = cacheInBytes; this.swapInBytes = swapInBytes; this.rssHighWatermarkInBytes = rssHighWatermarkInBytes; this.startTimeNanos = startTimeNanos; } private ProcessMemoryState(Parcel in) { Loading @@ -58,6 +60,7 @@ public final class ProcessMemoryState implements Parcelable { cacheInBytes = in.readLong(); swapInBytes = in.readLong(); rssHighWatermarkInBytes = in.readLong(); startTimeNanos = in.readLong(); } public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() { Loading Loading @@ -88,5 +91,6 @@ public final class ProcessMemoryState implements Parcelable { parcel.writeLong(cacheInBytes); parcel.writeLong(swapInBytes); parcel.writeLong(rssHighWatermarkInBytes); parcel.writeLong(startTimeNanos); } }
services/core/java/com/android/server/am/ActivityManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -18620,7 +18620,8 @@ public class ActivityManagerService extends IActivityManager.Stub memoryStat.rssInBytes, memoryStat.cacheInBytes, memoryStat.swapInBytes, memoryStat.rssHighWatermarkInBytes); memoryStat.rssHighWatermarkInBytes, memoryStat.startTimeNanos); processMemoryStates.add(processMemoryState); } } Loading @@ -18643,7 +18644,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessMemoryState processMemoryState = new ProcessMemoryState(uid, processName, oomScore, memoryStat.pgfault, memoryStat.pgmajfault, memoryStat.rssInBytes, memoryStat.cacheInBytes, memoryStat.swapInBytes, memoryStat.rssHighWatermarkInBytes); memoryStat.rssHighWatermarkInBytes, memoryStat.startTimeNanos); processMemoryStates.add(processMemoryState); } return processMemoryStates;
services/core/java/com/android/server/am/MemoryStatUtil.java +7 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NA import android.annotation.Nullable; import android.os.FileUtils; import android.os.SystemProperties; import android.system.Os; import android.system.OsConstants; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -71,6 +73,7 @@ public final class MemoryStatUtil { static final int BYTES_IN_KILOBYTE = 1024; static final int PAGE_SIZE = 4096; static final long JIFFY_NANOS = 1_000_000_000 / Os.sysconf(OsConstants._SC_CLK_TCK); private static final String TAG = TAG_WITH_CLASS_NAME ? "MemoryStatUtil" : TAG_AM; Loading Loading @@ -103,6 +106,7 @@ public final class MemoryStatUtil { private static final int PGFAULT_INDEX = 9; private static final int PGMAJFAULT_INDEX = 11; private static final int START_TIME_INDEX = 21; private static final int RSS_IN_PAGES_INDEX = 23; private MemoryStatUtil() {} Loading Loading @@ -238,6 +242,7 @@ public final class MemoryStatUtil { memoryStat.pgfault = Long.parseLong(splits[PGFAULT_INDEX]); memoryStat.pgmajfault = Long.parseLong(splits[PGMAJFAULT_INDEX]); memoryStat.rssInBytes = Long.parseLong(splits[RSS_IN_PAGES_INDEX]) * PAGE_SIZE; memoryStat.startTimeNanos = Long.parseLong(splits[START_TIME_INDEX]) * JIFFY_NANOS; return memoryStat; } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse value", e); Loading Loading @@ -279,5 +284,7 @@ public final class MemoryStatUtil { long swapInBytes; /** Number of bytes of peak anonymous and swap cache memory */ long rssHighWatermarkInBytes; /** Device time when the processes started. */ long startTimeNanos; } }