diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 16:44:17 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 16:44:17 +0000 |
commit | 538dde876885eec7f3ed1e6354216635a39ecd06 (patch) | |
tree | a5f0e155d480a2f553a283f56d5a78786efa87b5 /components | |
parent | 05c062a5766cd2a5bbaaa1cbe6d7f8c0b8dfd100 (diff) | |
download | chromium_src-538dde876885eec7f3ed1e6354216635a39ecd06.zip chromium_src-538dde876885eec7f3ed1e6354216635a39ecd06.tar.gz chromium_src-538dde876885eec7f3ed1e6354216635a39ecd06.tar.bz2 |
Report page load time for startup tests.
Add the following stats to startup tests:
* foreground_tab_load_complete - time it took for the foreground tab to load
* last_tab_load_complete - time it took for the last tab to load.
All of these are in ms relative to browser main entry.
Changes in Chrome:
Report tab load time using base::Time rather than base::TimeTicks since all times are relative to browser main entry.
BUG=317481
Review URL: https://codereview.chromium.org/62833008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236009 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/startup_metric_utils/startup_metric_utils.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/components/startup_metric_utils/startup_metric_utils.cc b/components/startup_metric_utils/startup_metric_utils.cc index 2a72b3a..beb41cd 100644 --- a/components/startup_metric_utils/startup_metric_utils.cc +++ b/components/startup_metric_utils/startup_metric_utils.cc @@ -40,6 +40,34 @@ base::Lock* GetSubsystemStartupTimeHashLock() { return slow_startup_time_hash_lock; } +// Record time of main entry so it can be read from Telemetry performance +// tests. +// TODO(jeremy): Remove once crbug.com/317481 is fixed. +void RecordMainEntryTimeHistogram() { + const int kLowWordMask = 0xFFFFFFFF; + const int kLower31BitsMask = 0x7FFFFFFF; + base::TimeDelta browser_main_entry_time_absolute = + base::TimeDelta::FromMilliseconds( + MainEntryPointTimeInternal()->ToInternalValue() / 1000.0); + + uint64 browser_main_entry_time_raw_ms = + browser_main_entry_time_absolute.InMilliseconds(); + + base::TimeDelta browser_main_entry_time_raw_ms_high_word = + base::TimeDelta::FromMilliseconds( + (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); + // Shift by one because histograms only support non-negative values. + base::TimeDelta browser_main_entry_time_raw_ms_low_word = + base::TimeDelta::FromMilliseconds( + (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask); + + // A timestamp is a 64 bit value, yet histograms can only store 32 bits. + HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteHighWord", + browser_main_entry_time_raw_ms_high_word); + HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteLowWord", + browser_main_entry_time_raw_ms_low_word); +} + bool g_main_entry_time_was_recorded = false; bool g_startup_stats_collection_finished = false; bool g_was_slow_startup = false; @@ -88,6 +116,8 @@ const base::Time MainEntryStartTime() { } void OnBrowserStartupComplete(bool is_first_run) { + RecordMainEntryTimeHistogram(); + // Bail if uptime < 7 minutes, to filter out cases where Chrome may have been // autostarted and the machine is under io pressure. const int64 kSevenMinutesInMilliseconds = |