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/common/metrics_constants.h b/common/metrics_constants.h
index b7633b9..af40300 100644
--- a/common/metrics_constants.h
+++ b/common/metrics_constants.h
@@ -17,6 +17,7 @@
 #ifndef UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
 #define UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
 
+#include <chrono>
 namespace chromeos_update_engine {
 
 namespace metrics {
@@ -140,6 +141,8 @@
   kNumConstants
 };
 
+constexpr auto kMetricFlushInterval = std::chrono::seconds(3);
+
 }  // namespace metrics
 
 }  // namespace chromeos_update_engine