Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7994)

Unified Diff: chrome/renderer/page_load_histograms.cc

Issue 6276001: Fix two bugs in recording web timing histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize member and fix lint Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/page_load_histograms.cc
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
index e4831f73392ccc32f6abfafd83a9d1dd01ecce7f..6cbde9304365acc3a0c7ad2779b21b616547d39d 100644
--- a/chrome/renderer/page_load_histograms.cc
+++ b/chrome/renderer/page_load_histograms.cc
@@ -38,6 +38,27 @@ 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,
+ NavigationState* navigation_state) {
+ if (navigation_start.is_null() ||
+ load_event_start.is_null() ||
+ load_event_end.is_null())
+ return;
+
+ if (navigation_state->web_timing_histograms_recorded())
+ return;
+ navigation_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);
+}
+
enum MissingStartType {
START_MISSING = 0x1,
COMMIT_MISSING = 0x2,
@@ -69,15 +90,11 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
if (scheme_type == 0)
return;
- // If we've already dumped, do nothing.
- // This simple bool works because we only dump for the main frame.
NavigationState* navigation_state =
NavigationState::FromDataSource(frame->dataSource());
- if (navigation_state->load_histograms_recorded())
- return;
// Times based on the Web Timing metrics.
- // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
+ // http://www.w3.org/TR/navigation-timing/
// 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.
@@ -85,13 +102,20 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
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,
+ navigation_state);
+
+ // If we've already dumped, do nothing.
+ // This simple bool works because we only dump for the main frame.
+ if (navigation_state->load_histograms_recorded())
+ return;
// Collect measurement times.
Time start = navigation_state->start_load_time();
Time commit = navigation_state->commit_load_time();
- // TODO(tonyg, jar): We aren't certain why the start is missing sometimes, but
- // we presume it is a very premature abandonment of the page.
+ // TODO(tonyg, jar): Start can be missing after an in-document navigation and
+ // 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.
int missing_start_type = 0;
@@ -103,17 +127,6 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
if (missing_start_type)
return;
- // Record the new PLT times prior to the faulty abandon check below.
- // 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.
- if (!load_event_start.is_null())
- PLT_HISTOGRAM("PLT.NavStartToLoadStart",
- load_event_start - navigation_start);
- if (!load_event_end.is_null())
- PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start);
-
// We properly handle null values for the next 3 variables.
Time request = navigation_state->request_time();
Time first_paint = navigation_state->first_paint_time();
@@ -122,7 +135,7 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
Time finish_all_loads = navigation_state->finish_load_time();
// TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary
- // historgram should help us to troubleshoot.
+ // histogram should help us to troubleshoot.
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;
« no previous file with comments | « chrome/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698