diff options
author | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-25 04:25:11 +0000 |
---|---|---|
committer | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-25 04:25:11 +0000 |
commit | 53bc6066b2127231fcde7cc3115040e84d039d00 (patch) | |
tree | aa07d98b17fde9c9584b21d6db46eb4c9a896cdd /chrome/renderer/page_load_histograms.cc | |
parent | e220483a8f65415e3bb8fe4393f9acd4bcbc835d (diff) | |
download | chromium_src-53bc6066b2127231fcde7cc3115040e84d039d00.zip chromium_src-53bc6066b2127231fcde7cc3115040e84d039d00.tar.gz chromium_src-53bc6066b2127231fcde7cc3115040e84d039d00.tar.bz2 |
Add PLT histograms that are equivalent to the existing set but use the PerformanceTiming data
BUG=
R=jar@chromium.org
Review URL: http://codereview.chromium.org/9254037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/page_load_histograms.cc')
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index a6a928c..a1cf288 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -47,25 +47,40 @@ static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { return static_cast<URLPattern::SchemeMasks>(0); } -static void DumpWebTiming(const Time& navigation_start, - const Time& load_event_start, - const Time& load_event_end, - DocumentState* document_state) { - if (navigation_start.is_null() || - load_event_start.is_null() || - load_event_end.is_null()) - return; +static void DumpPerformanceTiming(const WebPerformance& performance, + DocumentState* document_state) { + Time request = document_state->request_time(); + + Time navigation_start = Time::FromDoubleT(performance.navigationStart()); + Time request_start = Time::FromDoubleT(performance.requestStart()); + Time response_start = Time::FromDoubleT(performance.responseStart()); + Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); + Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); + Time begin = (request.is_null() ? navigation_start : request_start); + + DCHECK(!navigation_start.is_null()); + DCHECK(!request_start.is_null()); + DCHECK(!response_start.is_null()); + DCHECK(!load_event_start.is_null()); + DCHECK(!load_event_end.is_null()); if (document_state->web_timing_histograms_recorded()) return; document_state->set_web_timing_histograms_recorded(true); - // TODO(tonyg): There are many new details we can record, add them after the - // basic metrics are evaluated. // TODO(simonjam): There is no way to distinguish between abandonment and // intentional Javascript navigation before the load event fires. - PLT_HISTOGRAM("PLT.NavStartToLoadStart", load_event_start - navigation_start); - PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); + // TODO(dominich): Load type breakdown + PLT_HISTOGRAM("PLT.PT_BeginToCommit", response_start - begin); + PLT_HISTOGRAM("PLT.PT_BeginToFinish", load_event_end - begin); + PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc", load_event_start - begin); + PLT_HISTOGRAM("PLT.PT_CommitToFinish", load_event_end - response_start); + PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc", load_event_start - response_start); + PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", load_event_end - load_event_start); + PLT_HISTOGRAM("PLT.PT_RequestToFinish", load_event_end - navigation_start); + PLT_HISTOGRAM("PLT.PT_RequestToStart", request_start - navigation_start); + PLT_HISTOGRAM("PLT.PT_StartToCommit", response_start - request_start); + PLT_HISTOGRAM("PLT.PT_StartToFinish", load_event_end - request_start); } enum MissingStartType { @@ -116,12 +131,7 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // TODO(tonyg, jar): We are in the process of vetting these metrics against // the existing ones. Once we understand any differences, we will standardize // on a single set of metrics. - const WebPerformance& performance = frame->performance(); - Time navigation_start = Time::FromDoubleT(performance.navigationStart()); - Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); - Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); - DumpWebTiming(navigation_start, load_event_start, load_event_end, - document_state); + DumpPerformanceTiming(frame->performance(), document_state); // If we've already dumped, do nothing. // This simple bool works because we only dump for the main frame. @@ -136,6 +146,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // possibly other cases like a very premature abandonment of the page. // The PLT.MissingStart histogram should help us troubleshoot and then we can // remove this. + Time navigation_start = + Time::FromDoubleT(frame->performance().navigationStart()); int missing_start_type = 0; missing_start_type |= start.is_null() ? START_MISSING : 0; missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; @@ -154,6 +166,9 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary // histogram should help us to troubleshoot. + Time load_event_start = + Time::FromDoubleT(frame->performance().loadEventStart()); + Time load_event_end = Time::FromDoubleT(frame->performance().loadEventEnd()); int abandon_type = 0; abandon_type |= finish_doc.is_null() ? FINISH_DOC_MISSING : 0; abandon_type |= finish_all_loads.is_null() ? FINISH_ALL_LOADS_MISSING : 0; |