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 3969ed8a94cc70ee552aa861e1943d6f5493c887..141b45d56ea443aa64ed5aa0a0aa9c3879824615 100644 |
--- a/components/startup_metric_utils/browser/startup_metric_utils.cc |
+++ b/components/startup_metric_utils/browser/startup_metric_utils.cc |
@@ -29,7 +29,10 @@ volatile bool g_non_browser_ui_displayed = false; |
base::LazyInstance<base::Time>::Leaky g_process_creation_time = |
LAZY_INSTANCE_INITIALIZER; |
-base::LazyInstance<base::Time>::Leaky g_main_entry_point_time = |
+base::LazyInstance<base::Time>::Leaky g_browser_main_entry_point_time = |
+ LAZY_INSTANCE_INITIALIZER; |
+ |
+base::LazyInstance<base::Time>::Leaky g_renderer_main_entry_point_time = |
LAZY_INSTANCE_INITIALIZER; |
StartupTemperature g_startup_temperature = UNCERTAIN_STARTUP_TEMPERATURE; |
@@ -290,6 +293,21 @@ void RecordMainEntryTimeHistogram() { |
browser_main_entry_time_raw_ms_low_word); |
} |
+// Record renderer main entry time histogram. |
+void RecordRendererMainEntryHistogram() { |
+ const base::Time& browser_main_entry_point_time = |
+ g_browser_main_entry_point_time.Get(); |
+ const base::Time& renderer_main_entry_point_time = |
+ g_renderer_main_entry_point_time.Get(); |
+ |
+ if (!browser_main_entry_point_time.is_null() && |
+ !renderer_main_entry_point_time.is_null()) { |
+ UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
Alexei Svitkine (slow)
2015/11/09 16:06:03
Given that you're using this macro which adds extr
gab
2015/11/09 16:21:36
Good catch, @fdoray: can you also add a comment to
fdoray
2015/11/09 17:10:17
Done.
|
+ UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMainToRendererMain", |
+ browser_main_entry_point_time, renderer_main_entry_point_time); |
+ } |
+} |
+ |
// Environment variable that stores the timestamp when the executable's main() |
// function was entered. |
const char kChromeMainTimeEnvVar[] = "CHROME_MAIN_TIME"; |
@@ -324,7 +342,7 @@ void RecordStartupProcessCreationTime(const base::Time& time) { |
void RecordMainEntryPointTime(const base::Time& time) { |
DCHECK(MainEntryPointTime().is_null()); |
- g_main_entry_point_time.Get() = time; |
+ g_browser_main_entry_point_time.Get() = time; |
DCHECK(!MainEntryPointTime().is_null()); |
} |
@@ -417,6 +435,13 @@ void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta) { |
"Startup.BrowserOpenTabs", delta); |
} |
+void RecordRendererMainEntryTime(const base::Time& time) { |
+ // Record the renderer main entry time, but don't log the UMA metric |
+ // immediately because the startup temperature is not known yet. |
+ if (g_renderer_main_entry_point_time.Get().is_null()) |
+ g_renderer_main_entry_point_time.Get() = time; |
+} |
+ |
void RecordFirstWebContentsMainFrameLoad(const base::Time& time) { |
static bool is_first_call = true; |
if (!is_first_call || time.is_null()) |
@@ -448,6 +473,11 @@ void RecordFirstWebContentsNonEmptyPaint(const base::Time& time) { |
if (!is_first_call || time.is_null()) |
return; |
is_first_call = false; |
+ |
+ // Log Startup.BrowserMainToRendererMain now that the first renderer main |
+ // entry time and the startup temperature are known. |
+ RecordRendererMainEntryHistogram(); |
+ |
if (WasNonBrowserUIDisplayed() || g_process_creation_time.Get().is_null()) |
return; |
@@ -498,7 +528,7 @@ void RecordFirstWebContentsMainNavigationFinished(const base::Time& time) { |
} |
base::Time MainEntryPointTime() { |
- return g_main_entry_point_time.Get(); |
+ return g_browser_main_entry_point_time.Get(); |
} |
StartupTemperature GetStartupTemperature() { |