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/update_attempter_android.h b/update_attempter_android.h
index 3faeac9..641374a 100644
--- a/update_attempter_android.h
+++ b/update_attempter_android.h
@@ -130,7 +130,10 @@
// payload_id.
// |KprefsNumReboots|: number of reboots when applying the current update.
// |kPrefsSystemUpdatedMarker|: end timestamp of the last successful update.
- // |kPrefsUpdateTimestampStart|: start timestamp of the current update.
+ // |kPrefsUpdateTimestampStart|: start timestamp in monotonic time of the
+ // current update.
+ // |kPrefsUpdateBootTimestampStart|: start timestamp in boot time of
+ // the current update.
// |kPrefsCurrentBytesDownloaded|: number of bytes downloaded for the current
// payload_id.
// |kPrefsTotalBytesDownloaded|: number of bytes downloaded in total since
@@ -151,13 +154,14 @@
void UpdatePrefsAndReportUpdateMetricsOnReboot();
// Prefs to update:
- // |kPrefsPayloadAttemptNumber|, |kPrefsUpdateTimestampStart|
+ // |kPrefsPayloadAttemptNumber|, |kPrefsUpdateTimestampStart|,
+ // |kPrefsUpdateBootTimestampStart|
void UpdatePrefsOnUpdateStart(bool is_resume);
// Prefs to delete:
// |kPrefsNumReboots|, |kPrefsPayloadAttemptNumber|,
// |kPrefsSystemUpdatedMarker|, |kPrefsUpdateTimestampStart|,
- // |kPrefsCurrentBytesDownloaded|
+ // |kPrefsUpdateBootTimestampStart|, |kPrefsCurrentBytesDownloaded|
void ClearMetricsPrefs();
DaemonStateInterface* daemon_state_;