Merge "bootstat: Two changes to aid in debugging TimeSinceFactoryReset."

This commit is contained in:
James Hawkins 2016-03-30 17:13:42 +00:00 committed by Gerrit Code Review
commit a348dfcd65
1 changed files with 19 additions and 3 deletions

View File

@ -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",