From 6b930bf06076644b6b4456ee5eac01f1e1048132 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Tue, 8 Mar 2016 16:18:15 -0800 Subject: [PATCH] bootstat: Add more debug logging metrics to RecordFactoryReset. In an effort to track down the source of some wonky data being reported. Bug: 27550578 Change-Id: I1f08447c0203e7982d1b44bc04b531e96358c223 (cherry picked from commit 0660b307b869c76696adac35b14c3cfe91592c2a) --- bootstat/bootstat.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index bcc8abdf5..146080364 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -166,6 +167,15 @@ 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. + LogBootEvent(factory_reset_current_time, std::abs(current_time_utc)); + return; + } else { + LogBootEvent(factory_reset_current_time, current_time_utc); + } + // The factory_reset boot event does not exist after the device is reset, so // use this signal to mark the time of the factory reset. if (!boot_event_store.GetBootEvent("factory_reset", &record)) { @@ -179,6 +189,7 @@ void RecordFactoryReset() { // Calculate and record the difference in time between now and the // factory_reset time. time_t factory_reset_utc = record.second; + LogBootEvent("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",