summaryrefslogtreecommitdiffstats
path: root/bootstat
diff options
context:
space:
mode:
authorJames Hawkins <jhawkins@google.com>2017-02-02 16:21:25 -0800
committerJames Hawkins <jhawkins@google.com>2017-02-02 16:28:25 -0800
commitbe46fd1b949082bd189cfdd63634f7d775f28200 (patch)
tree2734c64221e7232f7b3ac60eb42c568ac483a281 /bootstat
parent3dfe40129657165f4cfe6c6cf0a5b6c8e8e6d4da (diff)
downloadcore-be46fd1b949082bd189cfdd63634f7d775f28200.tar.gz
core-be46fd1b949082bd189cfdd63634f7d775f28200.tar.bz2
core-be46fd1b949082bd189cfdd63634f7d775f28200.zip
bootstat: Log bootloader timing metrics to Tron.
Bug: 34944249 Test: None Change-Id: Ica6d87c8631a6cc8d70a01186686381f9dc352f9
Diffstat (limited to 'bootstat')
-rw-r--r--bootstat/bootstat.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index a626704cc..c85667e86 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -28,10 +28,12 @@
#include <map>
#include <memory>
#include <string>
+#include <vector>
#include <android/log.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
+#include <android-base/strings.h>
#include <cutils/properties.h>
#include "boot_event_record_store.h"
@@ -218,6 +220,27 @@ void RecordInitBootTimeProp(
}
}
+// Parses and records the set of bootloader stages and associated boot times
+// from the ro.boot.boottime system property.
+void RecordBootloaderTimings(BootEventRecordStore* boot_event_store) {
+ // |ro.boot.boottime| is of the form 'stage1:time1,...,stageN:timeN'.
+ std::string value = GetProperty("ro.boot.boottime");
+
+ auto stages = android::base::Split(value, ",");
+ for (auto const &stageTiming : stages) {
+ // |stageTiming| is of the form 'stage:time'.
+ auto stageTimingValues = android::base::Split(stageTiming, ":");
+ DCHECK_EQ(2, stageTimingValues.size());
+
+ std::string stageName = stageTimingValues[0];
+ int32_t time_ms;
+ if (android::base::ParseInt(stageTimingValues[1], &time_ms)) {
+ boot_event_store->AddBootEventWithValue(
+ "boottime.bootloader." + stageName, time_ms);
+ }
+ }
+}
+
// Records several metrics related to the time it takes to boot the device,
// including disambiguating boot time on encrypted or non-encrypted devices.
void RecordBootComplete() {
@@ -271,6 +294,8 @@ void RecordBootComplete() {
RecordInitBootTimeProp(&boot_event_store, "ro.boottime.init");
RecordInitBootTimeProp(&boot_event_store, "ro.boottime.init.selinux");
RecordInitBootTimeProp(&boot_event_store, "ro.boottime.init.cold_boot_wait");
+
+ RecordBootloaderTimings(&boot_event_store);
}
// Records the boot_reason metric by querying the ro.boot.bootreason system