Throttle metric writing by 3 seconds
After aosp/2320000 , pref writes are atomic but slower. Since
update_engine frequently writes metrics such as bytes downloaded to
disk, update time is negatively impacted. Throttle metric writing to
mitigate.
Bug: 259174530
Test: th
Change-Id: I09be219fa08d5569a5cb5b808e07da3d71a8131c
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index f3ed604..3174904 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -39,6 +39,7 @@
#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/network_selector_interface.h"
#include "update_engine/common/prefs_interface.h"
+#include "update_engine/metrics_utils.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include "update_engine/payload_consumer/postinstall_runner_action.h"
@@ -279,6 +280,9 @@
std::string update_certificates_path_{constants::kUpdateCertificatesPath};
ErrorCode last_error_{ErrorCode::kSuccess};
+ metrics_utils::PersistedValue<int64_t> metric_bytes_downloaded_;
+ metrics_utils::PersistedValue<int64_t> metric_total_bytes_downloaded_;
+
DISALLOW_COPY_AND_ASSIGN(UpdateAttempterAndroid);
};