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

Unified Diff: chrome/common/startup_metric_utils.h

Issue 11785014: Record metrics for slow startups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android/Linux Aurora compile failure Created 7 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
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.cc ('k') | chrome/common/startup_metric_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/startup_metric_utils.h
diff --git a/chrome/common/startup_metric_utils.h b/chrome/common/startup_metric_utils.h
index feeca61aeb41be96916822535e267f6dd6e2b7ef..e5e39152fa92e102f78acf6829e16180d9b32f52 100644
--- a/chrome/common/startup_metric_utils.h
+++ b/chrome/common/startup_metric_utils.h
@@ -5,6 +5,8 @@
#ifndef CHROME_COMMON_STARTUP_METRIC_UTILS_H_
#define CHROME_COMMON_STARTUP_METRIC_UTILS_H_
+#include <string>
+
#include "base/time.h"
// Utility functions to support metric collection for browser startup.
@@ -29,8 +31,27 @@ void SetNonBrowserUIDisplayed();
// timestamp.
void RecordMainEntryPointTime();
-// Return the time recorded by RecordMainEntryPointTime().
-const base::Time MainEntryStartTime();
+// Called just before the message loop is about to start. Entry point to record
+// startup stats.
+void OnBrowserStartupComplete();
+
+// Scoper that records the time period before it's destructed in a histogram
+// with the given name. The histogram is only recorded for slow chrome startups.
+// Useful for trying to figure out what parts of Chrome cause slow startup.
+class ScopedSlowStartupUMA {
+ public:
+ explicit ScopedSlowStartupUMA(const std::string& histogram_name)
+ : start_time_(base::TimeTicks::Now()),
+ histogram_name_(histogram_name) {}
+
+ ~ScopedSlowStartupUMA();
+
+ private:
+ const base::TimeTicks start_time_;
+ const std::string histogram_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA);
+};
} // namespace startup_metric_utils
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.cc ('k') | chrome/common/startup_metric_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698