Fix two android metrics reporting in update engine
1. The AttemptCurrentBytesDownloadedMiB was reported in bytes.
2. We were using the same start timestamp (in monotonic_time) for both
boot_time and monotonic_time. This leads to an inaccurate update
duration reporting. This cl saves an extra perf for the boot time and
calculates the duration accordingly.
Also report these information with a different metrics name.
Bug: 30989466
Test: Run an update and check the report
Change-Id: I69e20648501a736a59ff60ca9202ce7bdd9b6e34
diff --git a/metrics_utils.cc b/metrics_utils.cc
index d80d394..e7b2347 100644
--- a/metrics_utils.cc
+++ b/metrics_utils.cc
@@ -366,10 +366,19 @@
CHECK(prefs);
prefs->SetInt64(kPrefsUpdateTimestampStart,
update_start_time.ToInternalValue());
- LOG(INFO) << "Update Timestamp Start = "
+ LOG(INFO) << "Update Monotonic Timestamp Start = "
<< utils::ToString(update_start_time);
}
+void SetUpdateBootTimestampStart(const base::Time& update_start_boot_time,
+ PrefsInterface* prefs) {
+ CHECK(prefs);
+ prefs->SetInt64(kPrefsUpdateBootTimestampStart,
+ update_start_boot_time.ToInternalValue());
+ LOG(INFO) << "Update Boot Timestamp Start = "
+ << utils::ToString(update_start_boot_time);
+}
+
bool LoadAndReportTimeToReboot(MetricsReporterInterface* metrics_reporter,
PrefsInterface* prefs,
ClockInterface* clock) {