diff options
author | msw <msw@chromium.org> | 2015-08-27 16:06:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 23:06:54 +0000 |
commit | 43f4382d3a3f6991f002e46cfae9c5cf8a4b12f2 (patch) | |
tree | 032647e8639e227008eae8c9965944f76d61c0ec | |
parent | 7f5231e83fc0a0c6db19fb328c1c652214810417 (diff) | |
download | chromium_src-43f4382d3a3f6991f002e46cfae9c5cf8a4b12f2.zip chromium_src-43f4382d3a3f6991f002e46cfae9c5cf8a4b12f2.tar.gz chromium_src-43f4382d3a3f6991f002e46cfae9c5cf8a4b12f2.tar.bz2 |
Consolidate startup_metric_utils BrowserOpenTabs code.
Add startup_metric_utils::RecordBrowserOpenTabsDelta() helper.
Record a (reasonably corresponding?) time delta in Mandoline.
Change mojo:tracing to record a time delta instead of a timestamp.
Minor cleanup in chrome_browser_main.cc.
BUG=513779
TEST="./tools/perf/run_benchmark --browser=mandoline-debug startup.warm.blank_page" reports an 'open tabs time' closer to Chrome's.
R=sky@chromium.org,gab@chromium.org
Review URL: https://codereview.chromium.org/1315263002
Cr-Commit-Position: refs/heads/master@{#346021}
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 20 | ||||
-rw-r--r-- | components/html_viewer/stats_collection_controller.cc | 10 | ||||
-rw-r--r-- | components/startup_metric_utils/startup_metric_utils.cc | 9 | ||||
-rw-r--r-- | components/startup_metric_utils/startup_metric_utils.h | 3 | ||||
-rw-r--r-- | mandoline/ui/desktop_ui/browser_window.cc | 6 | ||||
-rw-r--r-- | mojo/services/tracing/public/interfaces/tracing.mojom | 4 | ||||
-rw-r--r-- | mojo/services/tracing/tracing_app.cc | 6 | ||||
-rw-r--r-- | mojo/services/tracing/tracing_app.h | 2 |
8 files changed, 31 insertions, 29 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 51500ea..c2c662e 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -1610,13 +1610,12 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // We are in regular browser boot sequence. Open initial tabs and enter the // main message loop. -#if defined(OS_CHROMEOS) + std::vector<Profile*> last_opened_profiles; +#if !defined(OS_CHROMEOS) // On ChromeOS multiple profiles doesn't apply, and will break if we load // them this early as the cryptohome hasn't yet been mounted (which happens - // only once we log in. - std::vector<Profile*> last_opened_profiles; -#else - std::vector<Profile*> last_opened_profiles = + // only once we log in). + last_opened_profiles = g_browser_process->profile_manager()->GetLastOpenedProfiles(); #endif // defined(OS_CHROMEOS) @@ -1625,7 +1624,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // This step is costly and is already measured in // Startup.StartupBrowserCreator_Start. - bool started = browser_creator_->Start( + const bool started = browser_creator_->Start( parsed_command_line(), base::FilePath(), profile_, last_opened_profiles); const base::TimeTicks start_time_step3 = base::TimeTicks::Now(); if (started) { @@ -1655,8 +1654,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { parameters().autorelease_pool->Recycle(); #endif // defined(OS_MACOSX) - base::TimeDelta delay = base::TimeTicks::Now() - browser_open_start; - UMA_HISTOGRAM_LONG_TIMES_100("Startup.BrowserOpenTabs", delay); + const base::TimeDelta delta = base::TimeTicks::Now() - browser_open_start; + startup_metric_utils::RecordBrowserOpenTabsDelta(delta); // If we're running tests (ui_task is non-null), then we don't want to // call RequestLanguageList or StartRepeatedVariationsSeedFetch or @@ -1671,11 +1670,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { translate::TranslateDownloadManager::RequestLanguageList( profile_->GetPrefs()); } - - run_message_loop_ = true; - } else { - run_message_loop_ = false; } + run_message_loop_ = started; browser_creator_.reset(); #if !defined(OS_LINUX) || defined(OS_CHROMEOS) // http://crbug.com/426393 diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc index 725ecc4..d519dde 100644 --- a/components/html_viewer/stats_collection_controller.cc +++ b/components/html_viewer/stats_collection_controller.cc @@ -42,14 +42,8 @@ void GetStartupPerformanceTimesCallbackImpl( startup_metric_utils::RecordBrowserWindowDisplay( base::Time::FromInternalValue(times->browser_window_display_time)); - // TODO(msw): Consolidate with chrome's PreMainMessageLoopRunImpl()... - // TODO(msw): Need to measure the "browser_open_start" time for this delta... - const base::Time browser_open_start = - base::Time::FromInternalValue(times->shell_process_creation_time); - const base::Time browser_open_tabs_time = - base::Time::FromInternalValue(times->browser_open_tabs_time); - base::TimeDelta delta = browser_open_tabs_time - browser_open_start; - UMA_HISTOGRAM_LONG_TIMES_100("Startup.BrowserOpenTabs", delta); + startup_metric_utils::RecordBrowserOpenTabsDelta( + base::TimeDelta::FromInternalValue(times->browser_open_tabs_time_delta)); startup_metric_utils::RecordFirstWebContentsMainFrameLoad( base::Time::FromInternalValue( diff --git a/components/startup_metric_utils/startup_metric_utils.cc b/components/startup_metric_utils/startup_metric_utils.cc index e3530a2..00ddf35 100644 --- a/components/startup_metric_utils/startup_metric_utils.cc +++ b/components/startup_metric_utils/startup_metric_utils.cc @@ -315,6 +315,15 @@ void RecordBrowserWindowDisplay(const base::Time& time) { time - g_process_creation_time.Get()); } +void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta) { + static bool is_first_call = true; + if (!is_first_call) + return; + is_first_call = false; + + UMA_HISTOGRAM_LONG_TIMES_100("Startup.BrowserOpenTabs", delta); +} + void RecordFirstWebContentsMainFrameLoad(const base::Time& time) { static bool is_first_call = true; if (!is_first_call || time.is_null()) diff --git a/components/startup_metric_utils/startup_metric_utils.h b/components/startup_metric_utils/startup_metric_utils.h index 38e695e..2c59f6e 100644 --- a/components/startup_metric_utils/startup_metric_utils.h +++ b/components/startup_metric_utils/startup_metric_utils.h @@ -48,6 +48,9 @@ void RecordBrowserMainMessageLoopStart(const base::Time& time, // Call this with the time when the first browser window became visible. void RecordBrowserWindowDisplay(const base::Time& time); +// Call this with the time delta that the browser spent opening its tabs. +void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta); + // Call this with the time when the first web contents loaded its main frame. void RecordFirstWebContentsMainFrameLoad(const base::Time& time); diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc index ec3eed9..198d5ad 100644 --- a/mandoline/ui/desktop_ui/browser_window.cc +++ b/mandoline/ui/desktop_ui/browser_window.cc @@ -132,8 +132,8 @@ void BrowserWindow::OnEmbed(mojo::View* root) { Embed(request.Pass()); } - // Record when the initial 'tabs' were opened, used for performance testing. - const base::Time open_tabs_time = base::Time::Now(); + // Record the time spent opening initial tabs, used for performance testing. + const base::TimeDelta open_tabs_delta = base::Time::Now() - display_time; // Record the browser startup time metrics, used for performance testing. static bool recorded_browser_startup_metrics = false; @@ -145,7 +145,7 @@ void BrowserWindow::OnEmbed(mojo::View* root) { tracing::StartupPerformanceDataCollectorPtr collector; app_->ConnectToService(request.Pass(), &collector); collector->SetBrowserWindowDisplayTime(display_time.ToInternalValue()); - collector->SetBrowserOpenTabsTime(open_tabs_time.ToInternalValue()); + collector->SetBrowserOpenTabsTimeDelta(open_tabs_delta.ToInternalValue()); collector->SetBrowserMessageLoopStartTime( manager_->startup_time().ToInternalValue()); recorded_browser_startup_metrics = true; diff --git a/mojo/services/tracing/public/interfaces/tracing.mojom b/mojo/services/tracing/public/interfaces/tracing.mojom index 935a862..6dbed2a 100644 --- a/mojo/services/tracing/public/interfaces/tracing.mojom +++ b/mojo/services/tracing/public/interfaces/tracing.mojom @@ -35,7 +35,7 @@ struct StartupPerformanceTimes { int64 shell_main_entry_point_time; int64 browser_message_loop_start_time; int64 browser_window_display_time; - int64 browser_open_tabs_time; + int64 browser_open_tabs_time_delta; // TODO(msw): Rename to avoid "web contents"? int64 first_web_contents_main_frame_load_time; // TODO(msw): Rename to match "FirstWebContents.NonEmptyPaint" metric? @@ -49,7 +49,7 @@ interface StartupPerformanceDataCollector { SetShellMainEntryPointTime(int64 time); SetBrowserMessageLoopStartTime(int64 time); SetBrowserWindowDisplayTime(int64 time); - SetBrowserOpenTabsTime(int64 time); + SetBrowserOpenTabsTimeDelta(int64 delta); SetFirstWebContentsMainFrameLoadTime(int64 time); SetFirstVisuallyNonEmptyLayoutTime(int64 time); diff --git a/mojo/services/tracing/tracing_app.cc b/mojo/services/tracing/tracing_app.cc index 504ba2c..d01cf37 100644 --- a/mojo/services/tracing/tracing_app.cc +++ b/mojo/services/tracing/tracing_app.cc @@ -109,9 +109,9 @@ void TracingApp::SetBrowserWindowDisplayTime(int64 time) { startup_performance_times_.browser_window_display_time = time; } -void TracingApp::SetBrowserOpenTabsTime(int64 time) { - if (startup_performance_times_.browser_open_tabs_time == 0) - startup_performance_times_.browser_open_tabs_time = time; +void TracingApp::SetBrowserOpenTabsTimeDelta(int64 delta) { + if (startup_performance_times_.browser_open_tabs_time_delta == 0) + startup_performance_times_.browser_open_tabs_time_delta = delta; } void TracingApp::SetFirstWebContentsMainFrameLoadTime(int64 time) { diff --git a/mojo/services/tracing/tracing_app.h b/mojo/services/tracing/tracing_app.h index 8d0ff2b..37a0331 100644 --- a/mojo/services/tracing/tracing_app.h +++ b/mojo/services/tracing/tracing_app.h @@ -52,7 +52,7 @@ class TracingApp void SetShellMainEntryPointTime(int64 time) override; void SetBrowserMessageLoopStartTime(int64 time) override; void SetBrowserWindowDisplayTime(int64 time) override; - void SetBrowserOpenTabsTime(int64 time) override; + void SetBrowserOpenTabsTimeDelta(int64 delta) override; void SetFirstWebContentsMainFrameLoadTime(int64 time) override; void SetFirstVisuallyNonEmptyLayoutTime(int64 time) override; void GetStartupPerformanceTimes( |