Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: components/startup_metric_utils/browser/startup_metric_utils.cc

Issue 1556103002: Add Startup.SystemUptime histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698