Migrate Debug(Failing)ElapsedClock to new API
Test: adb shell cmd stats pull-source 10046
Test: adb shell cmd stats pull-source 10047
Bug: 145565211
Change-Id: I515269ec77880d85ce2ce83bd81ea6f34b6e3db7
diff --git a/apex/service/java/com/android/server/stats/StatsCompanionService.java b/apex/service/java/com/android/server/stats/StatsCompanionService.java
index 018037c..6db9e7b 100644
--- a/apex/service/java/com/android/server/stats/StatsCompanionService.java
+++ b/apex/service/java/com/android/server/stats/StatsCompanionService.java
@@ -714,56 +714,6 @@
}
}
- private void pullDebugElapsedClock(int tagId,
- long elapsedNanos, final long wallClockNanos, List<StatsLogEventWrapper> pulledData) {
- final long elapsedMillis = SystemClock.elapsedRealtime();
- final long clockDiffMillis = mDebugElapsedClockPreviousValue == 0
- ? 0 : elapsedMillis - mDebugElapsedClockPreviousValue;
-
- StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
- e.writeLong(mDebugElapsedClockPullCount);
- e.writeLong(elapsedMillis);
- // Log it twice to be able to test multi-value aggregation from ValueMetric.
- e.writeLong(elapsedMillis);
- e.writeLong(clockDiffMillis);
- e.writeInt(1 /* always set */);
- pulledData.add(e);
-
- if (mDebugElapsedClockPullCount % 2 == 1) {
- StatsLogEventWrapper e2 = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
- e2.writeLong(mDebugElapsedClockPullCount);
- e2.writeLong(elapsedMillis);
- // Log it twice to be able to test multi-value aggregation from ValueMetric.
- e2.writeLong(elapsedMillis);
- e2.writeLong(clockDiffMillis);
- e2.writeInt(2 /* set on odd pulls */);
- pulledData.add(e2);
- }
-
- mDebugElapsedClockPullCount++;
- mDebugElapsedClockPreviousValue = elapsedMillis;
- }
-
- private void pullDebugFailingElapsedClock(int tagId,
- long elapsedNanos, final long wallClockNanos, List<StatsLogEventWrapper> pulledData) {
- StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
- final long elapsedMillis = SystemClock.elapsedRealtime();
- // Fails every 5 buckets.
- if (mDebugFailingElapsedClockPullCount++ % 5 == 0) {
- mDebugFailingElapsedClockPreviousValue = elapsedMillis;
- throw new RuntimeException("Failing debug elapsed clock");
- }
-
- e.writeLong(mDebugFailingElapsedClockPullCount);
- e.writeLong(elapsedMillis);
- // Log it twice to be able to test multi-value aggregation from ValueMetric.
- e.writeLong(elapsedMillis);
- e.writeLong(mDebugFailingElapsedClockPreviousValue == 0
- ? 0 : elapsedMillis - mDebugFailingElapsedClockPreviousValue);
- mDebugFailingElapsedClockPreviousValue = elapsedMillis;
- pulledData.add(e);
- }
-
/**
* Pulls various data.
*/
@@ -778,16 +728,6 @@
long wallClockNanos = SystemClock.currentTimeMicro() * 1000L;
switch (tagId) {
- case StatsLog.DEBUG_ELAPSED_CLOCK: {
- pullDebugElapsedClock(tagId, elapsedNanos, wallClockNanos, ret);
- break;
- }
-
- case StatsLog.DEBUG_FAILING_ELAPSED_CLOCK: {
- pullDebugFailingElapsedClock(tagId, elapsedNanos, wallClockNanos, ret);
- break;
- }
-
default:
Slog.w(TAG, "No such tagId data as " + tagId);
return null;