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

Commit 97098f0c authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Reset the data when pulled by statsd in order to swtich from value metric to gauge metric."

parents f4b29999 d25f7a88
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2196,8 +2196,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
@@ -929,6 +929,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 */);
@@ -957,6 +958,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 */);