OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; | 99 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; |
100 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; | 100 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; |
101 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, | 101 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, |
102 MISSING_START_TYPE_MAX); | 102 MISSING_START_TYPE_MAX); |
103 if (missing_start_type) | 103 if (missing_start_type) |
104 return; | 104 return; |
105 | 105 |
106 // Record the new PLT times prior to the faulty abandon check below. | 106 // Record the new PLT times prior to the faulty abandon check below. |
107 // TODO(tonyg): There are many new details we can record, add them after the | 107 // TODO(tonyg): There are many new details we can record, add them after the |
108 // basic metrics are evaluated. | 108 // basic metrics are evaluated. |
109 TimeDelta nav_start_to_load_start = load_event_start - navigation_start; | 109 // TODO(simonjam): There is no way to distinguish between abandonment and |
110 TimeDelta nav_start_to_load_end = load_event_end - navigation_start; | 110 // intentional Javascript navigation before the load event fires. |
111 PLT_HISTOGRAM("PLT.NavStartToLoadStart", nav_start_to_load_start); | 111 if (!load_event_start.is_null()) |
112 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", nav_start_to_load_end); | 112 PLT_HISTOGRAM("PLT.NavStartToLoadStart", |
| 113 load_event_start - navigation_start); |
| 114 if (!load_event_end.is_null()) |
| 115 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); |
113 | 116 |
114 // We properly handle null values for the next 3 variables. | 117 // We properly handle null values for the next 3 variables. |
115 Time request = navigation_state->request_time(); | 118 Time request = navigation_state->request_time(); |
116 Time first_paint = navigation_state->first_paint_time(); | 119 Time first_paint = navigation_state->first_paint_time(); |
117 Time first_paint_after_load = navigation_state->first_paint_after_load_time(); | 120 Time first_paint_after_load = navigation_state->first_paint_after_load_time(); |
118 Time finish_doc = navigation_state->finish_document_load_time(); | 121 Time finish_doc = navigation_state->finish_document_load_time(); |
119 Time finish_all_loads = navigation_state->finish_load_time(); | 122 Time finish_all_loads = navigation_state->finish_load_time(); |
120 | 123 |
121 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary | 124 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary |
122 // historgram should help us to troubleshoot. | 125 // historgram should help us to troubleshoot. |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 740 |
738 DCHECK(state); | 741 DCHECK(state); |
739 DCHECK(ds); | 742 DCHECK(ds); |
740 GURL url(ds->request().url()); | 743 GURL url(ds->request().url()); |
741 Time start = state->start_load_time(); | 744 Time start = state->start_load_time(); |
742 Time finish = state->finish_load_time(); | 745 Time finish = state->finish_load_time(); |
743 // TODO(mbelshe): should we log more stats? | 746 // TODO(mbelshe): should we log more stats? |
744 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 747 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
745 << url.spec(); | 748 << url.spec(); |
746 } | 749 } |
OLD | NEW |