system/corennnnn
修订版 | a7c591ffcefdea1ffe4d3ef3220c5e6896eb1ccd (tree) |
---|---|
时间 | 2016-08-16 08:24:45 |
作者 | TreeHugger Robot <treehugger-gerrit@goog...> |
Commiter | Android (Google) Code Review |
Merge "bootstat: Calculate and log the time_since_last_boot metric." into nyc-mr1-dev
@@ -169,7 +169,19 @@ std::string CalculateBootCompletePrefix() { | ||
169 | 169 | void RecordBootComplete() { |
170 | 170 | BootEventRecordStore boot_event_store; |
171 | 171 | BootEventRecordStore::BootEventRecord record; |
172 | + | |
172 | 173 | time_t uptime = bootstat::ParseUptime(); |
174 | + time_t current_time_utc = time(nullptr); | |
175 | + | |
176 | + if (boot_event_store.GetBootEvent("last_boot_time_utc", &record)) { | |
177 | + time_t last_boot_time_utc = record.second; | |
178 | + time_t time_since_last_boot = difftime(current_time_utc, | |
179 | + last_boot_time_utc); | |
180 | + boot_event_store.AddBootEventWithValue("time_since_last_boot", | |
181 | + time_since_last_boot); | |
182 | + } | |
183 | + | |
184 | + boot_event_store.AddBootEventWithValue("last_boot_time_utc", current_time_utc); | |
173 | 185 | |
174 | 186 | // The boot_complete metric has two variants: boot_complete and |
175 | 187 | // ota_boot_complete. The latter signifies that the device is booting after |