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

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

Issue 1558203003: Add Startup.TimeSinceLastStartup histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uptime
Patch Set: ifdef to fix build error on Android. Created 4 years, 11 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
Index: components/startup_metric_utils/browser/startup_metric_utils.h
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.h b/components/startup_metric_utils/browser/startup_metric_utils.h
index 51bae624a755f0a96dae3e0bea7c61ec11fea5fb..1027792ce66e567a30d97c3f143027c2c302f976 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.h
+++ b/components/startup_metric_utils/browser/startup_metric_utils.h
@@ -11,6 +11,9 @@
#include "base/time/time.h"
#include "build/build_config.h"
+class PrefRegistrySimple;
+class PrefService;
+
// Utility functions to support metric collection for browser startup. Timings
// should use TimeTicks whenever possible. OS-provided timings are still
// received as Time out of cross-platform support necessity but are converted to
@@ -42,6 +45,9 @@ enum StartupTemperature {
bool GetHardFaultCountForCurrentProcess(uint32_t* hard_fault_count);
#endif // defined(OS_WIN)
+// Registers startup related prefs in |registry|.
+void RegisterPrefs(PrefRegistrySimple* registry);
+
// Returns true if any UI other than the browser window has been displayed
// so far. Useful to test if UI has been displayed before the first browser
// window was shown, which would invalidate any surrounding timing metrics.
@@ -74,6 +80,13 @@ void RecordExeMainEntryPointTime(const base::Time& time);
void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
bool is_first_run);
+// Logs the Startup.TimeSinceLastStartup histogram. Obtains the timestamp of the
+// last startup from |pref_service| and overwrites it with the timestamp of the
+// current startup. If the startup temperature has been set by
+// RecordBrowserMainMessageLoopStart, the time since last startup is also logged
+// to an histogram suffixed with the startup temperature.
+void RecordTimeSinceLastStartup(PrefService* pref_service);
+
// Call this with the time when the first browser window became visible.
void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
« no previous file with comments | « components/startup_metric_utils/browser/BUILD.gn ('k') | components/startup_metric_utils/browser/startup_metric_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698