am d6372242: Merge "Further work on issue #18640385: Add procstats test mode" into lmp-mr1-dev

automerge: d525891

* commit 'd52589185f57ce7eb633d12dec98e4bbae4e33fd':
  Further work on issue #18640385: Add procstats test mode
This commit is contained in:
Dianne Hackborn
2014-12-10 19:26:35 +00:00
committed by android-build-merger
2 changed files with 16 additions and 3 deletions

View File

@@ -1841,7 +1841,9 @@ public final class ActivityManagerService extends ActivityManagerNative
proc = mPendingPssProcesses.remove(0);
procState = proc.pssProcState;
lastPssTime = proc.lastPssTime;
if (proc.thread != null && procState == proc.setProcState) {
if (proc.thread != null && procState == proc.setProcState
&& (lastPssTime+ProcessList.PSS_SAFE_TIME_FROM_STATE_CHANGE)
< SystemClock.uptimeMillis()) {
pid = proc.pid;
} else {
proc = null;
@@ -17747,7 +17749,8 @@ public final class ActivityManagerService extends ActivityManagerNative
+ (app.nextPssTime-now) + ": " + app);
} else {
if (now > app.nextPssTime || (now > (app.lastPssTime+ProcessList.PSS_MAX_INTERVAL)
&& now > (app.lastStateTime+ProcessList.PSS_MIN_TIME_FROM_STATE_CHANGE))) {
&& now > (app.lastStateTime+ProcessList.minTimeFromStateChange(
mTestPssMode)))) {
requestPssLocked(app, app.setProcState);
app.nextPssTime = ProcessList.computeNextPssTime(app.curProcState, false,
mTestPssMode, isSleeping(), now);

View File

@@ -411,7 +411,10 @@ final class ProcessList {
sb.append(ramKb);
}
// The minimum amount of time after a state change it is safe ro collect PSS.
// How long after a state change that it is safe to collect PSS without it being dirty.
public static final int PSS_SAFE_TIME_FROM_STATE_CHANGE = 1000;
// The minimum time interval after a state change it is safe to collect PSS.
public static final int PSS_MIN_TIME_FROM_STATE_CHANGE = 15*1000;
// The maximum amount of time we want to go between PSS collections.
@@ -441,6 +444,9 @@ final class ProcessList {
// The amount of time until PSS when a cached process stays in the same state.
private static final int PSS_SAME_CACHED_INTERVAL = 30*60*1000;
// The minimum time interval after a state change it is safe to collect PSS.
public static final int PSS_TEST_MIN_TIME_FROM_STATE_CHANGE = 10*1000;
// The amount of time during testing until PSS when a process first becomes top.
private static final int PSS_TEST_FIRST_TOP_INTERVAL = 3*1000;
@@ -548,6 +554,10 @@ final class ProcessList {
return sProcStateToProcMem[procState1] != sProcStateToProcMem[procState2];
}
public static long minTimeFromStateChange(boolean test) {
return test ? PSS_TEST_MIN_TIME_FROM_STATE_CHANGE : PSS_MIN_TIME_FROM_STATE_CHANGE;
}
public static long computeNextPssTime(int procState, boolean first, boolean test,
boolean sleeping, long now) {
final long[] table = test