Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7c591ff authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "bootstat: Calculate and log the time_since_last_boot metric." into nyc-mr1-dev

parents 47a1631f 16e84cc1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -169,7 +169,19 @@ std::string CalculateBootCompletePrefix() {
void RecordBootComplete() {
  BootEventRecordStore boot_event_store;
  BootEventRecordStore::BootEventRecord record;

  time_t uptime = bootstat::ParseUptime();
  time_t current_time_utc = time(nullptr);

  if (boot_event_store.GetBootEvent("last_boot_time_utc", &record)) {
    time_t last_boot_time_utc = record.second;
    time_t time_since_last_boot = difftime(current_time_utc,
                                           last_boot_time_utc);
    boot_event_store.AddBootEventWithValue("time_since_last_boot",
                                           time_since_last_boot);
  }

  boot_event_store.AddBootEventWithValue("last_boot_time_utc", current_time_utc);

  // The boot_complete metric has two variants: boot_complete and
  // ota_boot_complete.  The latter signifies that the device is booting after