From fff95ba5dd9da74afe6897db1726c0b5f70e8930 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Tue, 29 Mar 2016 16:13:49 -0700 Subject: [PATCH] bootstat: Two changes to aid in debugging TimeSinceFactoryReset. * Also log to the BootEventRecordStore to check lossiness. * Log factory_reset_current_time_failure separately. Bug: 27550578 Change-Id: Id3d579a74a59ac28290cb7d6048765519f9ba59b --- bootstat/bootstat.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 2639d0558..b81979730 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -224,13 +224,23 @@ void RecordFactoryReset() { time_t current_time_utc = time(nullptr); - static const char* factory_reset_current_time = "factory_reset_current_time"; if (current_time_utc < 0) { // UMA does not display negative values in buckets, so convert to positive. - bootstat::LogHistogram(factory_reset_current_time, std::abs(current_time_utc)); + bootstat::LogHistogram( + "factory_reset_current_time_failure", std::abs(current_time_utc)); + + // Logging via BootEventRecordStore to see if using bootstat::LogHistogram + // is losing records somehow. + boot_event_store.AddBootEventWithValue( + "factory_reset_current_time_failure", std::abs(current_time_utc)); return; } else { - bootstat::LogHistogram(factory_reset_current_time, current_time_utc); + bootstat::LogHistogram("factory_reset_current_time", current_time_utc); + + // Logging via BootEventRecordStore to see if using bootstat::LogHistogram + // is losing records somehow. + boot_event_store.AddBootEventWithValue( + "factory_reset_current_time", current_time_utc); } // The factory_reset boot event does not exist after the device is reset, so @@ -247,6 +257,12 @@ void RecordFactoryReset() { // factory_reset time. time_t factory_reset_utc = record.second; bootstat::LogHistogram("factory_reset_record_value", factory_reset_utc); + + // Logging via BootEventRecordStore to see if using bootstat::LogHistogram + // is losing records somehow. + boot_event_store.AddBootEventWithValue( + "factory_reset_record_value", factory_reset_utc); + time_t time_since_factory_reset = difftime(current_time_utc, factory_reset_utc); boot_event_store.AddBootEventWithValue("time_since_factory_reset",