Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d25f7a88 authored by Olivier Gaillard's avatar Olivier Gaillard
Browse files

Reset the data when pulled by statsd in order to swtich from value

metric to gauge metric.

Test: unit test
Change-Id: Idecc0ccfb3ccde1680b2394fb479ae6f7f2cfac2
parent 629d31c5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2163,8 +2163,8 @@ message Temperature {
/**
 * Pulls the statistics of calls to Binder.
 *
 * Binder stats are cumulative from boot unless somebody reset the data using
 * > adb shell dumpsys binder_calls_stats --reset
 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
 * config on the device.
 *
 * Next tag: 14
 */
+12 −0
Original line number Diff line number Diff line
@@ -118,10 +118,22 @@ public class BinderCallsStatsService extends Binder {
            this.mBinderCallsStats = binderCallsStats;
        }

        /** @see BinderCallsStats#reset */
        public void reset() {
            mBinderCallsStats.reset();
        }

        /**
         * @see BinderCallsStats#getExportedCallStats.
         *
         * Note that binder calls stats will be reset by statsd every time
         * the data is exported.
         */
        public ArrayList<BinderCallsStats.ExportedCallStat> getExportedCallStats() {
            return mBinderCallsStats.getExportedCallStats();
        }

        /** @see BinderCallsStats#getExportedExceptionStats */
        public ArrayMap<String, Integer> getExportedExceptionStats() {
            return mBinderCallsStats.getExportedExceptionStats();
        }
+3 −0
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        }

        List<ExportedCallStat> callStats = binderStats.getExportedCallStats();
        binderStats.reset();
        long elapsedNanos = SystemClock.elapsedRealtimeNanos();
        for (ExportedCallStat callStat : callStats) {
            StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 13 /* fields */);
@@ -934,6 +935,8 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        }

        ArrayMap<String, Integer> exceptionStats = binderStats.getExportedExceptionStats();
        // TODO: decouple binder calls exceptions with the rest of the binder calls data so that we
        // can reset the exception stats.
        long elapsedNanos = SystemClock.elapsedRealtimeNanos();
        for (Entry<String, Integer> entry : exceptionStats.entrySet()) {
            StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 2 /* fields */);