Merge "Log deferred job stats."
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 2ecfbe7..25c33e8 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -130,6 +130,7 @@
GenericAtom generic_atom = 82;
KeyValuePairsAtom key_value_pairs_atom = 83;
VibratorStateChanged vibrator_state_changed = 84;
+ DeferredJobStatsReported deferred_job_stats_reported = 85;
}
// Pulled events will start at field 10000.
@@ -469,6 +470,22 @@
optional State state = 3;
}
+/*
+ * Deferred job stats.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
+*/
+message DeferredJobStatsReported {
+ repeated AttributionNode attribution_node = 1;
+
+ // Number of jobs deferred.
+ optional int32 num_jobs_deferred = 2;
+
+ // Time since the last job runs.
+ optional int64 time_since_last_job_millis = 3;
+}
+
/**
* Logs when a job scheduler job state changes.
*
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index 260633a..389782a 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -2413,6 +2413,8 @@
BatteryStatsInternal mBatteryStatsInternal = LocalServices.getService
(BatteryStatsInternal.class);
mBatteryStatsInternal.noteJobsDeferred(uid, counter.numDeferred(), sinceLast);
+ StatsLog.write_non_chained(StatsLog.DEFERRED_JOB_STATS_REPORTED, uid, null,
+ counter.numDeferred(), sinceLast);
}
}
}