summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/am/ProcessStatsService.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-09-09 09:44:05 -0700
committerDianne Hackborn <hackbod@google.com>2013-09-09 09:49:52 -0700
commitbe4c1d74a758f40de25e796a991ccfd1fe356857 (patch)
tree8597f656b9de4c244c38e01a07dd2e35f03e06e4 /services/java/com/android/server/am/ProcessStatsService.java
parentc8fb093a8970b78084f2b4505fc283ac9e24317b (diff)
Fix issue #10671878: Proc stats needs to remove old data structures
We now keep track of which process and service states are actively in use, and remove any that are not in use during a commit. The activity manager needed to be tweaked to report this data, and ensure it does not try to operate on one of these structures when not in use. Also some other fixes: - We now keep track of process names associated with services, for display in the UI. - Keep track of total run time for each service, also for UI. - The parceled format is more efficient, not storing duplicates of process/package names, and writing times as ints when possible. - Reduced commit period from 1 day to 12 hours, so that our UI can be a little closer at its attempt to display the stats over 1 day. Change-Id: Ifeda0ffe963a7b49d8eb2a3f6923f3a5e71a4e43
Diffstat (limited to 'services/java/com/android/server/am/ProcessStatsService.java')
-rw-r--r--services/java/com/android/server/am/ProcessStatsService.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/java/com/android/server/am/ProcessStatsService.java b/services/java/com/android/server/am/ProcessStatsService.java
index 43ae46fd33c4..c180f6e38b28 100644
--- a/services/java/com/android/server/am/ProcessStatsService.java
+++ b/services/java/com/android/server/am/ProcessStatsService.java
@@ -54,12 +54,12 @@ public final class ProcessStatsService extends IProcessStats.Stub {
// exists in and the offset into the array to find it. The constants below
// define the encoding of that data in an integer.
- static final int MAX_HISTORIC_STATES = 4; // Maximum number of historic states we will keep.
+ static final int MAX_HISTORIC_STATES = 6; // Maximum number of historic states we will keep.
static final String STATE_FILE_PREFIX = "state-"; // Prefix to use for state filenames.
static final String STATE_FILE_SUFFIX = ".bin"; // Suffix to use for state filenames.
static final String STATE_FILE_CHECKIN_SUFFIX = ".ci"; // State files that have checked in.
static long WRITE_PERIOD = 30*60*1000; // Write file every 30 minutes or so.
- static long COMMIT_PERIOD = 24*60*60*1000; // Commit current stats every day.
+ static long COMMIT_PERIOD = 12*60*60*1000; // Commit current stats every 12 hours.
final ActivityManagerService mAm;
final File mBaseDir;
@@ -132,7 +132,7 @@ public final class ProcessStatsService extends IProcessStats.Stub {
ArrayMap<String, ProcessStats.ServiceState> services = pkg.mServices;
for (int k=0; k<services.size(); k++) {
ProcessStats.ServiceState service = services.valueAt(k);
- if (service.isActive()) {
+ if (service.isInUse()) {
if (service.mStartedState != ProcessStats.STATE_NOTHING) {
service.setStarted(true, memFactor, now);
}