Chromium Code Reviews| Index: components/startup_metric_utils/browser/startup_metric_utils.cc |
| diff --git a/components/startup_metric_utils/browser/startup_metric_utils.cc b/components/startup_metric_utils/browser/startup_metric_utils.cc |
| index 76491ff103f3c6d27857a6953fb17682105bc694..c65c078e69f18aeb7e2966195af09708a05f3ba4 100644 |
| --- a/components/startup_metric_utils/browser/startup_metric_utils.cc |
| +++ b/components/startup_metric_utils/browser/startup_metric_utils.cc |
| @@ -132,6 +132,21 @@ typedef NTSTATUS (WINAPI *NtQuerySystemInformationPtr)( |
| g_startup_temperature); \ |
| } |
| +// Returns the time elapsed between system boot and process launch. |
| +base::TimeDelta GetStartupUptime() { |
|
gab
2016/01/05 15:10:00
GetSystemUptimeOnProcessLaunch() ?
fdoray
2016/01/05 15:34:01
Done.
|
| + DCHECK(!g_process_creation_ticks.Get().is_null()); |
| + // base::SysInfo::Uptime returns the time elapsed between system boot and now. |
| + // Substract the time elapsed between process launch and now to get the time |
| + // elapsed between system boot and process launch. |
| + return base::SysInfo::Uptime() - |
| + (base::TimeTicks::Now() - g_process_creation_ticks.Get()); |
| +} |
| + |
| +void RecordUptimeHistogram() { |
| + UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(UMA_HISTOGRAM_LONG_TIMES_100, |
| + "Startup.Uptime", GetStartupUptime()); |
|
gab
2016/01/05 15:10:00
"Startup.SystemUptime" ? (i.e. to make it clear it
fdoray
2016/01/05 15:34:01
Done.
|
| +} |
| + |
| // On Windows, records the number of hard-faults that have occurred in the |
| // current chrome.exe process since it was started. This is a nop on other |
| // platforms. |
| @@ -392,6 +407,7 @@ void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks, |
| bool is_first_run) { |
| AddStartupEventsForTelemetry(); |
| RecordHardFaultHistogram(is_first_run); |
| + RecordUptimeHistogram(); |
| RecordMainEntryTimeHistogram(); |
| const base::TimeTicks& process_creation_ticks = |