summaryrefslogtreecommitdiffstats
path: root/chrome/common/startup_metric_utils.h
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 06:35:57 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 06:35:57 +0000
commit40c4f41f0f173502716a09799c97e1fe00e2e602 (patch)
treefcd151e4ad40283605e307cb4d7fd7af20c81639 /chrome/common/startup_metric_utils.h
parentbccb3df10cb4ae5889f6ad203a96e0cafb673fd7 (diff)
downloadchromium_src-40c4f41f0f173502716a09799c97e1fe00e2e602.zip
chromium_src-40c4f41f0f173502716a09799c97e1fe00e2e602.tar.gz
chromium_src-40c4f41f0f173502716a09799c97e1fe00e2e602.tar.bz2
Record metrics for slow startups
* Add a mechanism to collect duration of various operations for slow startups (defined as taking >= 10s). * Move collection of Startup.BrowserMessageLoopStartTimeFromMainEntry metric to startup_metric_utils.cc. * Change bucketing of Startup.BrowserMessageLoopStartTimeFromMainEntry from 0-5min instead of from 0-1 hour to improve granularity. * Collect metrics for major operations in Safe Browsing startup. BUG=160927 TEST=None Review URL: https://chromiumcodereview.appspot.com/11785014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/startup_metric_utils.h')
-rw-r--r--chrome/common/startup_metric_utils.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/chrome/common/startup_metric_utils.h b/chrome/common/startup_metric_utils.h
index feeca61..e5e3915 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