diff options
author | James Hawkins <jhawkins@google.com> | 2016-03-22 14:13:06 -0700 |
---|---|---|
committer | James Hawkins <jhawkins@google.com> | 2016-03-22 16:02:01 -0700 |
commit | 6f28299d0d10a7c397d563dc8293dacf6acadc04 (patch) | |
tree | b1a16cc6987008159219c1cf3606ae46a77f7d64 /bootstat/bootstat.cpp | |
parent | c30eb20658b01acb1e8ac53f75a61d46f303f5b9 (diff) |
bootstat: Track record inconsistencies w/ a debug metric, bootstat_mtime_matches_content.
Fixed a file descriptor leak while I was in here.
Bug: 27550578
Change-Id: I8e252e4f5bb3c4e2ae96a1560fbb32ae636722a0
Diffstat (limited to 'bootstat/bootstat.cpp')
-rw-r--r-- | bootstat/bootstat.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index e0548447d..2639d0558 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -32,26 +32,11 @@ #include <log/log.h> #include "boot_event_record_store.h" #include "event_log_list_builder.h" +#include "histogram_logger.h" #include "uptime_parser.h" namespace { -// Builds an EventLog buffer named |event| containing |data| and writes -// the log into the Tron histogram logs. -void LogBootEvent(const std::string& event, int32_t data) { - LOG(INFO) << "Logging boot metric: " << event << " " << data; - - EventLogListBuilder log_builder; - log_builder.Append(event); - log_builder.Append(data); - - std::unique_ptr<uint8_t[]> log; - size_t size; - log_builder.Release(&log, &size); - - android_bWriteLog(HISTOGRAM_LOG_TAG, log.get(), size); -} - // Scans the boot event record store for record files and logs each boot event // via EventLog. void LogBootEvents() { @@ -59,7 +44,7 @@ void LogBootEvents() { auto events = boot_event_store.GetAllBootEvents(); for (auto i = events.cbegin(); i != events.cend(); ++i) { - LogBootEvent(i->first, i->second); + bootstat::LogHistogram(i->first, i->second); } } @@ -242,10 +227,10 @@ void RecordFactoryReset() { 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)); + bootstat::LogHistogram(factory_reset_current_time, std::abs(current_time_utc)); return; } else { - LogBootEvent(factory_reset_current_time, current_time_utc); + bootstat::LogHistogram(factory_reset_current_time, current_time_utc); } // The factory_reset boot event does not exist after the device is reset, so @@ -261,7 +246,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); + bootstat::LogHistogram("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", |