Record VAB boot time metrics.
Bug: 180535575
Test: apply OTA, snapshotctl dump
Change-Id: Iedd761b2f6923a56b11f9d6868d6baf569ad38d0
diff --git a/aosp/cleanup_previous_update_action.cc b/aosp/cleanup_previous_update_action.cc
index 6eaa35b..b447509 100644
--- a/aosp/cleanup_previous_update_action.cc
+++ b/aosp/cleanup_previous_update_action.cc
@@ -20,6 +20,7 @@
#include <string>
#include <type_traits>
+#include <android-base/chrono_utils.h>
#include <android-base/properties.h>
#include <base/bind.h>
@@ -181,6 +182,10 @@
return;
}
+ auto boot_time = std::chrono::duration_cast<std::chrono::milliseconds>(
+ android::base::boot_clock::now().time_since_epoch());
+ merge_stats_->set_boot_complete_time_ms(boot_time.count());
+
LOG(INFO) << "Boot completed, waiting on markBootSuccessful()";
CheckSlotMarkedSuccessfulOrSchedule();
}
@@ -397,6 +402,11 @@
snapshot_->UpdateCowStats(merge_stats_);
+ auto merge_start_time = std::chrono::duration_cast<std::chrono::milliseconds>(
+ android::base::boot_clock::now().time_since_epoch());
+ merge_stats_->set_boot_complete_to_merge_start_time_ms(
+ merge_start_time.count() - merge_stats_->boot_complete_time_ms());
+
if (snapshot_->InitiateMerge()) {
WaitForMergeOrSchedule();
return;