diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-12-10 18:45:20 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-10 18:45:20 +0000 |
commit | d52589185f57ce7eb633d12dec98e4bbae4e33fd (patch) | |
tree | 9990988ca3e1929f870e13fb438fa3de86f89a55 | |
parent | da409fea8230c49666ed634aeb7db629fb9425f3 (diff) | |
parent | d63722429e311eca2ec9e9a9f80704bc521fef54 (diff) | |
download | frameworks_base-d52589185f57ce7eb633d12dec98e4bbae4e33fd.zip frameworks_base-d52589185f57ce7eb633d12dec98e4bbae4e33fd.tar.gz frameworks_base-d52589185f57ce7eb633d12dec98e4bbae4e33fd.tar.bz2 |
am d6372242: Merge "Further work on issue #18640385: Add procstats test mode" into lmp-mr1-dev
* commit 'd63722429e311eca2ec9e9a9f80704bc521fef54':
Further work on issue #18640385: Add procstats test mode
-rwxr-xr-x | services/core/java/com/android/server/am/ActivityManagerService.java | 7 | ||||
-rw-r--r-- | services/core/java/com/android/server/am/ProcessList.java | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 1227148..82afeed 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -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; @@ -17746,7 +17748,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); diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index aa86786..4ac6684 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -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 |