Chromium Code Reviews| 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..97e1882df80c3d6614831a8625ebf6cd08b617bb 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( |
| + UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserDLLMainToRendererDLLMain", |
| + 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()) |
|
gab
2015/11/06 18:05:17
Shouldn't this be a positive check for is_null()?
fdoray
2015/11/09 15:53:56
Done.
|
| + 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; |
| + |
| + // At this point, we know the first renderer main entry time and the startup |
| + // temperature, so log Startup.BrowserDLLMainToRendererDLLMain. |
|
gab
2015/11/06 18:05:17
Log Startup.BrowserDLLMainToRendererDLLMain now th
fdoray
2015/11/09 15:53:56
Done.
|
| + 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() { |