diff options
author | James Hawkins <jhawkins@google.com> | 2017-01-06 14:38:23 -0800 |
---|---|---|
committer | James Hawkins <jhawkins@google.com> | 2017-01-06 14:52:52 -0800 |
commit | ef0a090e6fc0b9061cacd94d521aca3c158b0f26 (patch) | |
tree | 213ccfd80af2f358ae12f73390c2742c794dc43d /bootstat | |
parent | 9f59a4663c0b6bdcc8a4fa82b0b966ee2522ffb1 (diff) | |
download | system_core-ef0a090e6fc0b9061cacd94d521aca3c158b0f26.tar.gz system_core-ef0a090e6fc0b9061cacd94d521aca3c158b0f26.tar.bz2 system_core-ef0a090e6fc0b9061cacd94d521aca3c158b0f26.zip |
bootstat: Log ro.boottime.init timing properties.
Bug: none
Test: adb logcat | grep bootstat
Change-Id: I3375c75e8ef39be710c8001f19a9e2fb493805e9
Diffstat (limited to 'bootstat')
-rw-r--r-- | bootstat/bootstat.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 7c0e85dc2..483c01d0a 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -207,6 +207,19 @@ std::string CalculateBootCompletePrefix() { return boot_complete_prefix; } +// Records the value of a given ro.boottime.init property in milliseconds. +void RecordInitBootTimeProp( + BootEventRecordStore* boot_event_store, const char* property) { + std::string value = GetProperty(property); + + int32_t time_in_ns; + if (android::base::ParseInt(value, &time_in_ns)) { + static constexpr int32_t kNanosecondsPerMillisecond = 1e6; + int32_t time_in_ms = static_cast<int32_t>(time_in_ns / kNanosecondsPerMillisecond); + boot_event_store->AddBootEventWithValue(property, time_in_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() { @@ -256,6 +269,10 @@ void RecordBootComplete() { // Record the total time from device startup to boot complete, regardless of // encryption state. boot_event_store.AddBootEventWithValue(boot_complete_prefix, uptime); + + 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"); } // Records the boot_reason metric by querying the ro.boot.bootreason system |