• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

修訂16e84cc1e1c8e1b02f646226e38cdc091c3f9a1a (tree)
時間2016-08-16 06:52:29
作者James Hawkins <jhawkins@goog...>
CommiterJames Hawkins

Log Message

bootstat: Calculate and log the time_since_last_boot metric.

Bug: 28163811
Change-Id: I2e1350531f6a0fc891c270cfdfca6c8ad63f8040
(cherry picked from commit 2d8b3e66c6fd298bc8f4dc4e8205bb469a89a6f8)

Change Summary

差異

--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -169,7 +169,19 @@ std::string CalculateBootCompletePrefix() {
169169 void RecordBootComplete() {
170170 BootEventRecordStore boot_event_store;
171171 BootEventRecordStore::BootEventRecord record;
172+
172173 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);
173185
174186 // The boot_complete metric has two variants: boot_complete and
175187 // ota_boot_complete. The latter signifies that the device is booting after