diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-13 23:56:43 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-13 23:56:43 +0000 |
commit | e0b18175c58d33966979784c4e1652c9a8381f14 (patch) | |
tree | 5122dc89e02cf524499e6dea27d3d842b8580aa8 /chrome/renderer/page_load_histograms.cc | |
parent | 50a81b1491129d0825d8fb81c112158e7aead6f7 (diff) | |
download | chromium_src-e0b18175c58d33966979784c4e1652c9a8381f14.zip chromium_src-e0b18175c58d33966979784c4e1652c9a8381f14.tar.gz chromium_src-e0b18175c58d33966979784c4e1652c9a8381f14.tar.bz2 |
Add histograms for prerendering to the renderer process, second try.
BUG=71160
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=74034
Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=74040
Review URL: http://codereview.chromium.org/6448002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/page_load_histograms.cc')
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 48ef7e5..3603981 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -28,6 +28,54 @@ static const size_t kPLTCount(100); #define PLT_HISTOGRAM(name, sample) \ UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, kPLTMin, kPLTMax, kPLTCount); +namespace { + +// Histograms to determine prerendering's impact on perceived PLT. +void UpdatePrerenderHistograms(NavigationState* navigation_state, + const Time& begin, const Time& finish_all_loads, + const TimeDelta& begin_to_finish_all_loads) { + // Load time for non-prerendered pages. + static bool use_prerender_histogram = + base::FieldTrialList::Find("Prerender") && + !base::FieldTrialList::Find("Prerender")->group_name().empty(); + if (!navigation_state->was_started_as_prerender()) { + if (use_prerender_histogram) { + PLT_HISTOGRAM(base::FieldTrial::MakeName( + "PLT.PerceivedLoadTime", "Prerender"), + begin_to_finish_all_loads); + } + return; + } + + // Histogram for usage rate of prerendered pages. + Time prerendered_page_display = + navigation_state->prerendered_page_display_time(); + UMA_HISTOGRAM_ENUMERATION("PLT.PageUsed_PrerenderLoad", + prerendered_page_display.is_null() ? 0 : 1, 2); + if (prerendered_page_display.is_null()) + return; + + // Histograms for perceived load time of prerendered pages. + PLT_HISTOGRAM("PLT.TimeUntilDisplay_PrerenderLoad", + prerendered_page_display - begin); + TimeDelta perceived_load_time = finish_all_loads - prerendered_page_display; + if (perceived_load_time < TimeDelta::FromSeconds(0)) { + PLT_HISTOGRAM("PLT.PrerenderIdleTime_PrerenderLoad", -perceived_load_time); + perceived_load_time = TimeDelta::FromSeconds(0); + } + PLT_HISTOGRAM("PLT.PerceivedLoadTime_PrerenderLoad", perceived_load_time); + if (use_prerender_histogram) { + PLT_HISTOGRAM(base::FieldTrial::MakeName( + "PLT.PerceivedLoadTime_PrerenderLoad", "Prerender"), + perceived_load_time); + PLT_HISTOGRAM(base::FieldTrial::MakeName( + "PLT.PerceivedLoadTime", "Prerender"), + perceived_load_time); + } +} + +} // namespace + // Returns the scheme type of the given URL if its type is one for which we // dump page load histograms. Otherwise returns NULL. static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { @@ -255,10 +303,19 @@ void PageLoadHistograms::Dump(WebFrame* frame) { PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", begin_to_finish_all_loads); break; + case NavigationState::PRERENDER_LOAD: + PLT_HISTOGRAM("PLT.BeginToFinishDoc_PrerenderLoad", + begin_to_finish_doc); + PLT_HISTOGRAM("PLT.BeginToFinish_PrerenderLoad", + begin_to_finish_all_loads); + break; default: break; } + UpdatePrerenderHistograms(navigation_state, begin, finish_all_loads, + begin_to_finish_all_loads); + // Histograms to determine if DNS prefetching has an impact on PLT. static bool use_dns_histogram(base::FieldTrialList::Find("DnsImpact") && !base::FieldTrialList::Find("DnsImpact")->group_name().empty()); |