diff options
| author | Bookatz <bookatz@google.com> | 2017-09-07 19:06:08 -0700 |
|---|---|---|
| committer | Adam Bookatz <bookatz@google.com> | 2017-09-13 22:24:25 +0000 |
| commit | 82b34117ee63598c5fa7f07edfd57bee8096abf5 (patch) | |
| tree | 494acc56f2cab4c5b28923b26aadb6972798a931 /core/java/android | |
| parent | 50df711a5125460acb8d2960ffc0a1f17a818103 (diff) | |
Disable screen-off RPM timing in BatteryStats
RPM = resource power manager.
Fetching the rpm stats (specifically, the subsystem low power stats) is
slow... too slow to reasonably do each time the screen state changes.
Therefore, it is disabled until fetching this information can be done
more quickly. Consequently, the screen-off RPM values will be incorrect
until it is re-enabled; they are therefore not printed.
Bug: 65164435
Bug: 62549421
Test: manual
Change-Id: I54d54f244c69ee372f22ecd99f32570db4aeb222
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/BatteryStats.java | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 49afeeb4642a..66b6b47887b9 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -53,6 +53,8 @@ public abstract class BatteryStats implements Parcelable { private static final String TAG = "BatteryStats"; private static final boolean LOCAL_LOGV = false; + /** Fetching RPM stats is too slow to do each time screen changes, so disable it. */ + protected static final boolean SCREEN_OFF_RPM_STATS_ENABLED = false; /** @hide */ public static final String SERVICE_NAME = "batterystats"; @@ -214,7 +216,7 @@ public abstract class BatteryStats implements Parcelable { * New in version 25: * - Package wakeup alarms are now on screen-off timebase * New in version 26: - * - Resource power manager (rpm) states + * - Resource power manager (rpm) states [but screenOffRpm is disabled from working properly] */ static final String CHECKIN_VERSION = "26"; @@ -3338,8 +3340,14 @@ public abstract class BatteryStats implements Parcelable { ? (screenOffTimer.getTotalTimeLocked(rawRealtime, which) + 500) / 1000 : 0; int screenOffCount = screenOffTimer != null ? screenOffTimer.getCountLocked(which) : 0; - dumpLine(pw, 0 /* uid */, category, RESOURCE_POWER_MANAGER_DATA, - "\"" + ent.getKey() + "\"", timeMs, count, screenOffTimeMs, screenOffCount); + if (SCREEN_OFF_RPM_STATS_ENABLED) { + dumpLine(pw, 0 /* uid */, category, RESOURCE_POWER_MANAGER_DATA, + "\"" + ent.getKey() + "\"", timeMs, count, screenOffTimeMs, + screenOffCount); + } else { + dumpLine(pw, 0 /* uid */, category, RESOURCE_POWER_MANAGER_DATA, + "\"" + ent.getKey() + "\"", timeMs, count); + } } } @@ -4629,18 +4637,20 @@ public abstract class BatteryStats implements Parcelable { } pw.println(); } - final Map<String, ? extends Timer> screenOffRpmStats = getScreenOffRpmStats(); - if (screenOffRpmStats.size() > 0) { - pw.print(prefix); - pw.println(" Resource Power Manager Stats for when screen was off"); + if (SCREEN_OFF_RPM_STATS_ENABLED) { + final Map<String, ? extends Timer> screenOffRpmStats = getScreenOffRpmStats(); if (screenOffRpmStats.size() > 0) { - for (Map.Entry<String, ? extends Timer> ent : screenOffRpmStats.entrySet()) { - final String timerName = ent.getKey(); - final Timer timer = ent.getValue(); - printTimer(pw, sb, timer, rawRealtime, which, prefix, timerName); + pw.print(prefix); + pw.println(" Resource Power Manager Stats for when screen was off"); + if (screenOffRpmStats.size() > 0) { + for (Map.Entry<String, ? extends Timer> ent : screenOffRpmStats.entrySet()) { + final String timerName = ent.getKey(); + final Timer timer = ent.getValue(); + printTimer(pw, sb, timer, rawRealtime, which, prefix, timerName); + } } + pw.println(); } - pw.println(); } final long[] cpuFreqs = getCpuFreqs(); |
