summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jonathan Backer <backer@google.com> 2024-04-10 09:23:12 -0400
committer Jonathan Backer <backer@google.com> 2024-04-15 10:03:45 -0400
commit948b9b0798d0af4b4f346075c253ac1def5e19d4 (patch)
treed3468580faaeea33e582237d4251880f3f13146b
parent0e75605d0cf7cb1537fe6920ddae5019e6017998 (diff)
Fix kernel wakeup durations
Before this change, atom KERNEL_WAKEUP_REPORTED recorded the uptime from kernel wake to first partial wakelock started. With this change, atom KERNEL_WAKEUP_REPORTED records the complete uptime associated with the kernel wake. There is significant CPU scheduling delay on WearOS devices due to CPU starvation (go/wear-metric-problem). This means that a thread hop can take take a large amount of wall time. As per b/309610775#comment9, the calls to aggreateWakeupReasonLocked by noteWakeupReasonLocked and noteStartWakeLocked are racing and potential scheduling delays can really skew the order. Test: ./out/host/linux-x86/bin/statsd_testdrive -e 36 Bug: 309610775 Change-Id: I8ec939e00d1535da4bdcd3a1aa0e028424ef97e4
-rw-r--r--services/core/java/com/android/server/power/stats/BatteryStatsImpl.java9
1 files changed, 1 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java b/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java
index d060c7ca3034..54cb9c9a9a9b 100644
--- a/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java
+++ b/services/core/java/com/android/server/power/stats/BatteryStatsImpl.java
@@ -4885,7 +4885,6 @@ public class BatteryStatsImpl extends BatteryStats {
if (type == WAKE_TYPE_PARTIAL) {
// Only care about partial wake locks, since full wake locks
// will be canceled when the user puts the screen to sleep.
- aggregateLastWakeupUptimeLocked(elapsedRealtimeMs, uptimeMs);
if (historyName == null) {
historyName = name;
}
@@ -5205,20 +5204,14 @@ public class BatteryStatsImpl extends BatteryStats {
}
@GuardedBy("this")
- void aggregateLastWakeupUptimeLocked(long elapsedRealtimeMs, long uptimeMs) {
+ public void noteWakeupReasonLocked(String reason, long elapsedRealtimeMs, long uptimeMs) {
if (mLastWakeupReason != null) {
long deltaUptimeMs = uptimeMs - mLastWakeupUptimeMs;
SamplingTimer timer = getWakeupReasonTimerLocked(mLastWakeupReason);
timer.add(deltaUptimeMs * 1000, 1, elapsedRealtimeMs); // time in in microseconds
mFrameworkStatsLogger.kernelWakeupReported(deltaUptimeMs * 1000, mLastWakeupReason,
mLastWakeupElapsedTimeMs);
- mLastWakeupReason = null;
}
- }
-
- @GuardedBy("this")
- public void noteWakeupReasonLocked(String reason, long elapsedRealtimeMs, long uptimeMs) {
- aggregateLastWakeupUptimeLocked(elapsedRealtimeMs, uptimeMs);
mHistory.recordWakeupEvent(elapsedRealtimeMs, uptimeMs, reason);
mLastWakeupReason = reason;
mLastWakeupUptimeMs = uptimeMs;