diff options
| author | Dianne Hackborn <hackbod@google.com> | 2013-09-03 18:12:53 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2013-09-03 18:12:53 -0700 |
| commit | ae36b236d2b8d040f142bee169742da2f392efaa (patch) | |
| tree | ab9c9110844c4cd8bbe9ba4306f95262e65f2d95 /core/java | |
| parent | 59f6b510569a4c70c43c5b9b80fa70d5a28d99f0 (diff) | |
Fix issue #10427108: Google+ has long running process
There was a bug in counting the number of starting services
in a process that would cause it to count too many (it would
increment at any state change while the service is started, not
just when starting/stopping).
Also reduce dumpsys output -- only print summaries for old
data. There is probably no utility in printing the long details
of all that data.
Change-Id: I1c1e901b0214c01eb7d071f23166fc6f3702ca67
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/app/ProcessStats.java | 16 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/ProcessCpuTracker.java | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/core/java/com/android/internal/app/ProcessStats.java b/core/java/com/android/internal/app/ProcessStats.java index ac9bf16655dc..16b119a68cb9 100644 --- a/core/java/com/android/internal/app/ProcessStats.java +++ b/core/java/com/android/internal/app/ProcessStats.java @@ -1583,7 +1583,7 @@ public final class ProcessStats implements Parcelable { final int NSRVS = pkgState.mServices.size(); if (NPROCS > 0 || NSRVS > 0) { if (!printedHeader) { - pw.println("Per-Package Process Stats:"); + pw.println("Per-Package Stats:"); printedHeader = true; } pw.print(" * "); pw.print(pkgName); pw.print(" / "); @@ -1651,7 +1651,8 @@ public final class ProcessStats implements Parcelable { continue; } if (!printedHeader) { - pw.println("Process Stats:"); + pw.println(); + pw.println("Per-Process Stats:"); printedHeader = true; } pw.print(" * "); pw.print(procName); pw.print(" / "); @@ -2536,7 +2537,8 @@ public final class ProcessStats implements Parcelable { if (mActive <= 0) { throw new IllegalStateException("Service " + this + " has mActive=" + mActive); } - int state = started ? memFactor : STATE_NOTHING; + final boolean wasStarted = mStartedState != STATE_NOTHING; + final int state = started ? memFactor : STATE_NOTHING; if (mStartedState != state) { if (mStartedState != STATE_NOTHING) { addStateTime(SERVICE_STARTED + (mStartedState*SERVICE_COUNT), @@ -2546,8 +2548,8 @@ public final class ProcessStats implements Parcelable { } mStartedState = state; mStartedStartTime = now; - if (mProc != null) { - mProc = mProc.pullFixedProc(mPackage); + mProc = mProc.pullFixedProc(mPackage); + if (wasStarted != started) { if (started) { mProc.incStartedServices(memFactor, now); } else { @@ -2561,7 +2563,7 @@ public final class ProcessStats implements Parcelable { if (mActive <= 0) { throw new IllegalStateException("Service " + this + " has mActive=" + mActive); } - int state = bound ? memFactor : STATE_NOTHING; + final int state = bound ? memFactor : STATE_NOTHING; if (mBoundState != state) { if (mBoundState != STATE_NOTHING) { addStateTime(SERVICE_BOUND + (mBoundState*SERVICE_COUNT), @@ -2578,7 +2580,7 @@ public final class ProcessStats implements Parcelable { if (mActive <= 0) { throw new IllegalStateException("Service " + this + " has mActive=" + mActive); } - int state = executing ? memFactor : STATE_NOTHING; + final int state = executing ? memFactor : STATE_NOTHING; if (mExecState != state) { if (mExecState != STATE_NOTHING) { addStateTime(SERVICE_EXEC + (mExecState*SERVICE_COUNT), now - mExecStartTime); diff --git a/core/java/com/android/internal/os/ProcessCpuTracker.java b/core/java/com/android/internal/os/ProcessCpuTracker.java index c092807ab908..30ca73efb42b 100644 --- a/core/java/com/android/internal/os/ProcessCpuTracker.java +++ b/core/java/com/android/internal/os/ProcessCpuTracker.java @@ -35,7 +35,7 @@ import java.util.Comparator; import java.util.StringTokenizer; public class ProcessCpuTracker { - private static final String TAG = "ProcessStats"; + private static final String TAG = "ProcessCpuTracker"; private static final boolean DEBUG = false; private static final boolean localLOGV = DEBUG || false; |
