Collect telemetry data for System Server Loopers.
Adds LooperStats and LooperStatsService which set a static
Looper.Observer to record the count of dispatched messages and
cpu/latency information. The aggregated stats are collected by
Westworld as pulled atoms.
The collection is disabled by default and requires a manual call to
enable:
adb shell cmd looper_stats enable
Test: Unit tests and tested manually that the collected data seems
reasonable.
Change-Id: I7162fbca4e324f62887f95df3405205cbe4416ca
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index ecc13b2..6431344 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -747,6 +747,11 @@
traceBeginAndSlog("StartBinderCallsStatsService");
mSystemServiceManager.startService(BinderCallsStatsService.LifeCycle.class);
traceEnd();
+
+ // Tracks time spent in handling messages in handlers.
+ traceBeginAndSlog("StartLooperStatsService");
+ mSystemServiceManager.startService(LooperStatsService.Lifecycle.class);
+ traceEnd();
}
/**