summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc12
-rw-r--r--chrome/browser/browser_main.h4
-rw-r--r--chrome/browser/browser_main_gtk.cc4
-rw-r--r--chrome/browser/browser_main_mac.mm4
-rw-r--r--chrome/browser/browser_main_win.cc15
5 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 915aba4..871c792 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -560,6 +560,10 @@ void HandleTestParameters(const CommandLine& command_line) {
void RunUIMessageLoop(BrowserProcess* browser_process) {
TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, "");
+ // This should be invoked as close to the start of the browser's
+ // UI thread message loop as possible to get a stable measurement
+ // across versions.
+ RecordBrowserStartupTime();
// If the UI thread blocks, the whole UI is unresponsive.
// Do not allow disk IO from the UI thread.
@@ -1773,6 +1777,10 @@ int BrowserMain(const MainFunctionParams& parameters) {
parameters.ui_task->Run();
delete parameters.ui_task;
} else {
+ // Most general initialization is behind us, but opening a
+ // tab and/or session restore and such is still to be done.
+ base::TimeTicks browser_open_start = base::TimeTicks::Now();
+
// We are in regular browser boot sequence. Open initial tabs and enter the
// main message loop.
if (browser_init.Start(parsed_command_line, FilePath(), profile,
@@ -1799,6 +1807,10 @@ int BrowserMain(const MainFunctionParams& parameters) {
// because Start() will add things to it while creating the main window.
if (pool)
pool->Recycle();
+
+ UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserOpenTabs",
+ base::TimeTicks::Now() - browser_open_start);
+
RunUIMessageLoop(browser_process.get());
}
}
diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h
index ae27721..41e6f95 100644
--- a/chrome/browser/browser_main.h
+++ b/chrome/browser/browser_main.h
@@ -172,4 +172,8 @@ void RecordBreakpadStatusUMA(MetricsService* metrics);
// present on the current platform.
void WarnAboutMinimumSystemRequirements();
+// Records the time from our process' startup to the present time in
+// the UMA histogram |metric_name|.
+void RecordBrowserStartupTime();
+
#endif // CHROME_BROWSER_BROWSER_MAIN_H_
diff --git a/chrome/browser/browser_main_gtk.cc b/chrome/browser/browser_main_gtk.cc
index 072ed0e..7ac9824 100644
--- a/chrome/browser/browser_main_gtk.cc
+++ b/chrome/browser/browser_main_gtk.cc
@@ -158,6 +158,10 @@ void WarnAboutMinimumSystemRequirements() {
// Nothing to warn about on GTK right now.
}
+void RecordBrowserStartupTime() {
+ // Not implemented on GTK for now.
+}
+
// From browser_main_win.h, stubs until we figure out the right thing...
int DoUninstallTasks(bool chrome_still_running) {
diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm
index 5ebe23d..cfd5ebd 100644
--- a/chrome/browser/browser_main_mac.mm
+++ b/chrome/browser/browser_main_mac.mm
@@ -37,6 +37,10 @@ void RecordBreakpadStatusUMA(MetricsService* metrics) {
metrics->RecordBreakpadHasDebugger(base::debug::BeingDebugged());
}
+void RecordBrowserStartupTime() {
+ // Not implemented on Mac for now.
+}
+
void WarnAboutMinimumSystemRequirements() {
// Nothing to check for on Mac right now.
}
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index e0a704c..ef1ceba 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -84,6 +84,21 @@ void WarnAboutMinimumSystemRequirements() {
}
}
+void RecordBrowserStartupTime() {
+ // Calculate the time that has elapsed from our own process creation.
+ FILETIME creation_time = {};
+ FILETIME ignore = {};
+ ::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, &ignore,
+ &ignore);
+
+ base::TimeDelta elapsed_from_startup =
+ base::Time::Now() - base::Time::FromFileTime(creation_time);
+
+ // Record the time to present in a histogram.
+ UMA_HISTOGRAM_MEDIUM_TIMES("Startup.BrowserMessageLoopStartTime",
+ elapsed_from_startup);
+}
+
int AskForUninstallConfirmation() {
int ret = ResultCodes::NORMAL_EXIT;
views::Window::CreateChromeWindow(NULL, gfx::Rect(),