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

Commit b0ebe11b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Report total latency instead of average for jobs last run"

parents e87a8a9e 0ca706bb
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -294,8 +294,8 @@ public abstract class BatteryStats implements Parcelable {
    /**
     * jbd line is:
     * BATTERY_STATS_CHECKIN_VERSION, uid, which, "jbd",
     * jobsDeferredEventCount, jobsDeferredCount, averageLatencyMillis,
     * count at latency < 1 hr, count at latency < 2 hrs, count at latency < 6 hrs, beyond 6 hrs
     * jobsDeferredEventCount, jobsDeferredCount, totalLatencyMillis,
     * count at latency < 1 hr, count at latency 1 to 2 hrs, 2 to 4 hrs, 4 to 8 hrs, and past 8 hrs
     * <p>
     * @see #JOB_FRESHNESS_BUCKETS
     */
@@ -364,13 +364,14 @@ public abstract class BatteryStats implements Parcelable {
    /**
     * These are the thresholds for bucketing last time since a job was run for an app
     * that just moved to ACTIVE due to a launch. So if the last time a job ran was less
     * than 30 minutes ago, then it's reasonably fresh, 2 hours ago, not so fresh and so
     * than 1 hour ago, then it's reasonably fresh, 2 hours ago, not so fresh and so
     * on.
     */
    public static final long[] JOB_FRESHNESS_BUCKETS = {
            1 * 60 * 60 * 1000L,
            2 * 60 * 60 * 1000L,
            6 * 60 * 60 * 1000L,
            4 * 60 * 60 * 1000L,
            8 * 60 * 60 * 1000L,
            Long.MAX_VALUE
    };

+4 −8
Original line number Diff line number Diff line
@@ -7872,12 +7872,10 @@ public class BatteryStatsImpl extends BatteryStats {
                return;
            }
            final int deferredCount = mJobsDeferredCount.getCountLocked(which);
            final long averageLatency = deferredEventCount != 0
                    ? mJobsFreshnessTimeMs.getCountLocked(which) / deferredEventCount
                    : 0L;
            final long totalLatency = mJobsFreshnessTimeMs.getCountLocked(which);
            sb.append(deferredEventCount); sb.append(',');
            sb.append(deferredCount); sb.append(',');
            sb.append(averageLatency);
            sb.append(totalLatency);
            for (int i = 0; i < JOB_FRESHNESS_BUCKETS.length; i++) {
                if (mJobsFreshnessBuckets[i] == null) {
                    sb.append(",0");
@@ -7896,12 +7894,10 @@ public class BatteryStatsImpl extends BatteryStats {
                return;
            }
            final int deferredCount = mJobsDeferredCount.getCountLocked(which);
            final long averageLatency = deferredEventCount != 0
                    ? mJobsFreshnessTimeMs.getCountLocked(which) / deferredEventCount
                    : 0L;
            final long totalLatency = mJobsFreshnessTimeMs.getCountLocked(which);
            sb.append("times="); sb.append(deferredEventCount); sb.append(", ");
            sb.append("count="); sb.append(deferredCount); sb.append(", ");
            sb.append("avgLatency="); sb.append(averageLatency); sb.append(", ");
            sb.append("totalLatencyMs="); sb.append(totalLatency); sb.append(", ");
            for (int i = 0; i < JOB_FRESHNESS_BUCKETS.length; i++) {
                sb.append("<"); sb.append(JOB_FRESHNESS_BUCKETS[i]); sb.append("ms=");
                if (mJobsFreshnessBuckets[i] == null) {