Read RSS high watermark
The value is read from /proc/PID/status or memory.max_usage_in_bytes (for devices with per-app memcg enabled). Reading the value takes about 2ms per process. Full snapshot taken by statsd is around 300ms. Results: https://docs.google.com/spreadsheets/d/1vG9ku8Uu8104CmKbO4cNeEKVeeByvHY--p0_dK1GAdA/edit?usp=sharing Bug: 115477992 Test: atest FrameworksServicesTests Change-Id: I87995cbd85085375ade685f29e986ba173f9693e
This commit is contained in:
@@ -32,10 +32,11 @@ public final class ProcessMemoryState implements Parcelable {
|
||||
public final long rssInBytes;
|
||||
public final long cacheInBytes;
|
||||
public final long swapInBytes;
|
||||
public final long rssHighWatermarkInBytes;
|
||||
|
||||
public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault,
|
||||
long pgmajfault, long rssInBytes, long cacheInBytes,
|
||||
long swapInBytes) {
|
||||
long swapInBytes, long rssHighWatermarkInBytes) {
|
||||
this.uid = uid;
|
||||
this.processName = processName;
|
||||
this.oomScore = oomScore;
|
||||
@@ -44,6 +45,7 @@ public final class ProcessMemoryState implements Parcelable {
|
||||
this.rssInBytes = rssInBytes;
|
||||
this.cacheInBytes = cacheInBytes;
|
||||
this.swapInBytes = swapInBytes;
|
||||
this.rssHighWatermarkInBytes = rssHighWatermarkInBytes;
|
||||
}
|
||||
|
||||
private ProcessMemoryState(Parcel in) {
|
||||
@@ -55,6 +57,7 @@ public final class ProcessMemoryState implements Parcelable {
|
||||
rssInBytes = in.readLong();
|
||||
cacheInBytes = in.readLong();
|
||||
swapInBytes = in.readLong();
|
||||
rssHighWatermarkInBytes = in.readLong();
|
||||
}
|
||||
|
||||
public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
|
||||
@@ -84,5 +87,6 @@ public final class ProcessMemoryState implements Parcelable {
|
||||
parcel.writeLong(rssInBytes);
|
||||
parcel.writeLong(cacheInBytes);
|
||||
parcel.writeLong(swapInBytes);
|
||||
parcel.writeLong(rssHighWatermarkInBytes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user