am a4ce31f5: Merge "Small fixes to battery stats." into gingerbread

Merge commit 'a4ce31f5e080eae6c97e6f37040db0c7f0fc78f2' into gingerbread-plus-aosp

* commit 'a4ce31f5e080eae6c97e6f37040db0c7f0fc78f2':
  Small fixes to battery stats.
This commit is contained in:
Dianne Hackborn
2010-09-09 21:34:33 -07:00
committed by Android Git Automerger
2 changed files with 7 additions and 5 deletions

View File

@ -1585,10 +1585,10 @@ public abstract class BatteryStats implements Parcelable {
sb.append(ent.getKey()); sb.append(":\n"); sb.append(ent.getKey()); sb.append(":\n");
sb.append(prefix); sb.append(" CPU: "); sb.append(prefix); sb.append(" CPU: ");
formatTime(sb, userTime); sb.append("usr + "); formatTime(sb, userTime); sb.append("usr + ");
formatTime(sb, systemTime); sb.append("krn\n"); formatTime(sb, systemTime); sb.append("krn");
if (starts != 0) { if (starts != 0) {
sb.append(prefix); sb.append(" "); sb.append(starts); sb.append("\n"); sb.append(prefix); sb.append(" ");
sb.append(" proc starts"); sb.append(starts); sb.append(" proc starts");
} }
pw.println(sb.toString()); pw.println(sb.toString());
for (int e=0; e<numExcessive; e++) { for (int e=0; e<numExcessive; e++) {

View File

@ -3633,9 +3633,11 @@ public final class BatteryStatsImpl extends BatteryStats {
} }
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) { if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = getPidStatsLocked(pid); Pid p = getPidStatsLocked(pid);
if (p.mWakeStart == 0) {
p.mWakeStart = SystemClock.elapsedRealtime(); p.mWakeStart = SystemClock.elapsedRealtime();
} }
} }
}
public void noteStopWakeLocked(int pid, String name, int type) { public void noteStopWakeLocked(int pid, String name, int type) {
StopwatchTimer t = getWakeTimerLocked(name, type); StopwatchTimer t = getWakeTimerLocked(name, type);
@ -3644,7 +3646,7 @@ public final class BatteryStatsImpl extends BatteryStats {
} }
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) { if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = mPids.get(pid); Pid p = mPids.get(pid);
if (p != null) { if (p != null && p.mWakeStart != 0) {
p.mWakeSum += SystemClock.elapsedRealtime() - p.mWakeStart; p.mWakeSum += SystemClock.elapsedRealtime() - p.mWakeStart;
p.mWakeStart = 0; p.mWakeStart = 0;
} }