OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 if (url.SchemeIs("http")) | 43 if (url.SchemeIs("http")) |
44 return URLPattern::SCHEME_HTTP; | 44 return URLPattern::SCHEME_HTTP; |
45 else if (url.SchemeIs("https")) | 45 else if (url.SchemeIs("https")) |
46 return URLPattern::SCHEME_HTTPS; | 46 return URLPattern::SCHEME_HTTPS; |
47 return static_cast<URLPattern::SchemeMasks>(0); | 47 return static_cast<URLPattern::SchemeMasks>(0); |
48 } | 48 } |
49 | 49 |
50 static void DumpWebTiming(const Time& navigation_start, | 50 static void DumpWebTiming(const Time& navigation_start, |
51 const Time& load_event_start, | 51 const Time& load_event_start, |
52 const Time& load_event_end, | 52 const Time& load_event_end, |
53 content::NavigationState* navigation_state) { | 53 NavigationState::LoadTimes* load_times) { |
54 if (navigation_start.is_null() || | 54 if (navigation_start.is_null() || |
55 load_event_start.is_null() || | 55 load_event_start.is_null() || |
56 load_event_end.is_null()) | 56 load_event_end.is_null()) |
57 return; | 57 return; |
58 | 58 |
59 if (navigation_state->web_timing_histograms_recorded()) | 59 if (load_times->web_timing_histograms_recorded()) |
60 return; | 60 return; |
61 navigation_state->set_web_timing_histograms_recorded(true); | 61 load_times->set_web_timing_histograms_recorded(true); |
62 | 62 |
63 // TODO(tonyg): There are many new details we can record, add them after the | 63 // TODO(tonyg): There are many new details we can record, add them after the |
64 // basic metrics are evaluated. | 64 // basic metrics are evaluated. |
65 // TODO(simonjam): There is no way to distinguish between abandonment and | 65 // TODO(simonjam): There is no way to distinguish between abandonment and |
66 // intentional Javascript navigation before the load event fires. | 66 // intentional Javascript navigation before the load event fires. |
67 PLT_HISTOGRAM("PLT.NavStartToLoadStart", load_event_start - navigation_start); | 67 PLT_HISTOGRAM("PLT.NavStartToLoadStart", load_event_start - navigation_start); |
68 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); | 68 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); |
69 } | 69 } |
70 | 70 |
71 enum MissingStartType { | 71 enum MissingStartType { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 GetSupportedSchemeType(frame->document().url()); | 103 GetSupportedSchemeType(frame->document().url()); |
104 if (scheme_type == 0) | 104 if (scheme_type == 0) |
105 return; | 105 return; |
106 | 106 |
107 // Ignore multipart requests. | 107 // Ignore multipart requests. |
108 if (frame->dataSource()->response().isMultipartPayload()) | 108 if (frame->dataSource()->response().isMultipartPayload()) |
109 return; | 109 return; |
110 | 110 |
111 NavigationState* navigation_state = | 111 NavigationState* navigation_state = |
112 NavigationState::FromDataSource(frame->dataSource()); | 112 NavigationState::FromDataSource(frame->dataSource()); |
| 113 NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
113 | 114 |
114 // Times based on the Web Timing metrics. | 115 // Times based on the Web Timing metrics. |
115 // http://www.w3.org/TR/navigation-timing/ | 116 // http://www.w3.org/TR/navigation-timing/ |
116 // TODO(tonyg, jar): We are in the process of vetting these metrics against | 117 // TODO(tonyg, jar): We are in the process of vetting these metrics against |
117 // the existing ones. Once we understand any differences, we will standardize | 118 // the existing ones. Once we understand any differences, we will standardize |
118 // on a single set of metrics. | 119 // on a single set of metrics. |
119 const WebPerformance& performance = frame->performance(); | 120 const WebPerformance& performance = frame->performance(); |
120 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); | 121 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); |
121 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); | 122 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); |
122 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); | 123 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); |
123 DumpWebTiming(navigation_start, load_event_start, load_event_end, | 124 DumpWebTiming(navigation_start, load_event_start, load_event_end, load_times); |
124 navigation_state); | |
125 | 125 |
126 // If we've already dumped, do nothing. | 126 // If we've already dumped, do nothing. |
127 // This simple bool works because we only dump for the main frame. | 127 // This simple bool works because we only dump for the main frame. |
128 if (navigation_state->load_histograms_recorded()) | 128 if (load_times->load_histograms_recorded()) |
129 return; | 129 return; |
130 | 130 |
131 // Collect measurement times. | 131 // Collect measurement times. |
132 Time start = navigation_state->start_load_time(); | 132 Time start = load_times->start_load_time(); |
133 Time commit = navigation_state->commit_load_time(); | 133 Time commit = load_times->commit_load_time(); |
134 | 134 |
135 // TODO(tonyg, jar): Start can be missing after an in-document navigation and | 135 // TODO(tonyg, jar): Start can be missing after an in-document navigation and |
136 // possibly other cases like a very premature abandonment of the page. | 136 // possibly other cases like a very premature abandonment of the page. |
137 // The PLT.MissingStart histogram should help us troubleshoot and then we can | 137 // The PLT.MissingStart histogram should help us troubleshoot and then we can |
138 // remove this. | 138 // remove this. |
139 int missing_start_type = 0; | 139 int missing_start_type = 0; |
140 missing_start_type |= start.is_null() ? START_MISSING : 0; | 140 missing_start_type |= start.is_null() ? START_MISSING : 0; |
141 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; | 141 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; |
142 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; | 142 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; |
143 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, | 143 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, |
144 MISSING_START_TYPE_MAX); | 144 MISSING_START_TYPE_MAX); |
145 if (missing_start_type) | 145 if (missing_start_type) |
146 return; | 146 return; |
147 | 147 |
148 // We properly handle null values for the next 3 variables. | 148 // We properly handle null values for the next 3 variables. |
149 Time request = navigation_state->request_time(); | 149 Time request = load_times->request_time(); |
150 Time first_paint = navigation_state->first_paint_time(); | 150 Time first_paint = load_times->first_paint_time(); |
151 Time first_paint_after_load = navigation_state->first_paint_after_load_time(); | 151 Time first_paint_after_load = load_times->first_paint_after_load_time(); |
152 Time finish_doc = navigation_state->finish_document_load_time(); | 152 Time finish_doc = load_times->finish_document_load_time(); |
153 Time finish_all_loads = navigation_state->finish_load_time(); | 153 Time finish_all_loads = load_times->finish_load_time(); |
154 | 154 |
155 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary | 155 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary |
156 // histogram should help us to troubleshoot. | 156 // histogram should help us to troubleshoot. |
157 int abandon_type = 0; | 157 int abandon_type = 0; |
158 abandon_type |= finish_doc.is_null() ? FINISH_DOC_MISSING : 0; | 158 abandon_type |= finish_doc.is_null() ? FINISH_DOC_MISSING : 0; |
159 abandon_type |= finish_all_loads.is_null() ? FINISH_ALL_LOADS_MISSING : 0; | 159 abandon_type |= finish_all_loads.is_null() ? FINISH_ALL_LOADS_MISSING : 0; |
160 abandon_type |= load_event_start.is_null() ? LOAD_EVENT_START_MISSING : 0; | 160 abandon_type |= load_event_start.is_null() ? LOAD_EVENT_START_MISSING : 0; |
161 abandon_type |= load_event_end.is_null() ? LOAD_EVENT_END_MISSING : 0; | 161 abandon_type |= load_event_end.is_null() ? LOAD_EVENT_END_MISSING : 0; |
162 UMA_HISTOGRAM_ENUMERATION("PLT.AbandonType", abandon_type, ABANDON_TYPE_MAX); | 162 UMA_HISTOGRAM_ENUMERATION("PLT.AbandonType", abandon_type, ABANDON_TYPE_MAX); |
163 | 163 |
164 // Handle case where user hits "stop" or "back" before loading completely. | 164 // Handle case where user hits "stop" or "back" before loading completely. |
165 bool abandoned_page = finish_doc.is_null(); | 165 bool abandoned_page = finish_doc.is_null(); |
166 if (abandoned_page) { | 166 if (abandoned_page) { |
167 finish_doc = Time::Now(); | 167 finish_doc = Time::Now(); |
168 navigation_state->set_finish_document_load_time(finish_doc); | 168 load_times->set_finish_document_load_time(finish_doc); |
169 } | 169 } |
170 | 170 |
171 // TODO(jar): We should really discriminate the definition of "abandon" more | 171 // TODO(jar): We should really discriminate the definition of "abandon" more |
172 // finely. We should have: | 172 // finely. We should have: |
173 // abandon_before_document_loaded | 173 // abandon_before_document_loaded |
174 // abandon_before_onload_fired | 174 // abandon_before_onload_fired |
175 | 175 |
176 if (finish_all_loads.is_null()) { | 176 if (finish_all_loads.is_null()) { |
177 finish_all_loads = Time::Now(); | 177 finish_all_loads = Time::Now(); |
178 navigation_state->set_finish_load_time(finish_all_loads); | 178 load_times->set_finish_load_time(finish_all_loads); |
179 } else { | 179 } else { |
180 DCHECK(!abandoned_page); // How can the doc have finished but not the page? | 180 DCHECK(!abandoned_page); // How can the doc have finished but not the page? |
181 if (abandoned_page) | 181 if (abandoned_page) |
182 return; // Don't try to record a stat which is broken. | 182 return; // Don't try to record a stat which is broken. |
183 } | 183 } |
184 | 184 |
185 navigation_state->set_load_histograms_recorded(true); | 185 load_times->set_load_histograms_recorded(true); |
186 | 186 |
187 // Note: Client side redirects will have no request time. | 187 // Note: Client side redirects will have no request time. |
188 Time begin = request.is_null() ? start : request; | 188 Time begin = request.is_null() ? start : request; |
189 TimeDelta begin_to_finish_doc = finish_doc - begin; | 189 TimeDelta begin_to_finish_doc = finish_doc - begin; |
190 TimeDelta begin_to_finish_all_loads = finish_all_loads - begin; | 190 TimeDelta begin_to_finish_all_loads = finish_all_loads - begin; |
191 TimeDelta start_to_finish_all_loads = finish_all_loads - start; | 191 TimeDelta start_to_finish_all_loads = finish_all_loads - start; |
192 TimeDelta start_to_commit = commit - start; | 192 TimeDelta start_to_commit = commit - start; |
193 | 193 |
194 NavigationState::LoadType load_type = navigation_state->load_type(); | 194 NavigationState::LoadType load_type = navigation_state->load_type(); |
195 | 195 |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 // but didn't get SPDY. | 750 // but didn't get SPDY. |
751 static const bool use_spdy_histogram = | 751 static const bool use_spdy_histogram = |
752 base::FieldTrialList::TrialExists("SpdyImpact"); | 752 base::FieldTrialList::TrialExists("SpdyImpact"); |
753 if (use_spdy_histogram) { | 753 if (use_spdy_histogram) { |
754 // We take extra effort to only compute these once. | 754 // We take extra effort to only compute these once. |
755 static bool in_spdy_trial = base::FieldTrialList::Find( | 755 static bool in_spdy_trial = base::FieldTrialList::Find( |
756 "SpdyImpact")->group_name() == "npn_with_spdy"; | 756 "SpdyImpact")->group_name() == "npn_with_spdy"; |
757 static bool in_http_trial = base::FieldTrialList::Find( | 757 static bool in_http_trial = base::FieldTrialList::Find( |
758 "SpdyImpact")->group_name() == "npn_with_http"; | 758 "SpdyImpact")->group_name() == "npn_with_http"; |
759 | 759 |
760 bool spdy_trial_success = navigation_state->was_fetched_via_spdy() ? | 760 bool spdy_trial_success = load_times->was_fetched_via_spdy() ? |
761 in_spdy_trial : in_http_trial; | 761 in_spdy_trial : in_http_trial; |
762 if (spdy_trial_success) { | 762 if (spdy_trial_success) { |
763 // Histograms to determine if SPDY has an impact for https traffic. | 763 // Histograms to determine if SPDY has an impact for https traffic. |
764 // TODO(mbelshe): After we've seen the difference between BeginToFinish | 764 // TODO(mbelshe): After we've seen the difference between BeginToFinish |
765 // and StartToFinish, consider removing one or the other. | 765 // and StartToFinish, consider removing one or the other. |
766 if (scheme_type == URLPattern::SCHEME_HTTPS && | 766 if (scheme_type == URLPattern::SCHEME_HTTPS && |
767 navigation_state->was_npn_negotiated()) { | 767 load_times->was_npn_negotiated()) { |
768 UMA_HISTOGRAM_ENUMERATION( | 768 UMA_HISTOGRAM_ENUMERATION( |
769 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), | 769 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), |
770 abandoned_page ? 1 : 0, 2); | 770 abandoned_page ? 1 : 0, 2); |
771 switch (load_type) { | 771 switch (load_type) { |
772 case NavigationState::LINK_LOAD_NORMAL: | 772 case NavigationState::LINK_LOAD_NORMAL: |
773 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 773 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
774 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), | 774 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), |
775 begin_to_finish_all_loads); | 775 begin_to_finish_all_loads); |
776 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 776 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
777 "PLT.StartToFinish_LinkLoadNormal", "SpdyImpact"), | 777 "PLT.StartToFinish_LinkLoadNormal", "SpdyImpact"), |
(...skipping 14 matching lines...) Expand all Loading... |
792 start_to_commit); | 792 start_to_commit); |
793 break; | 793 break; |
794 default: | 794 default: |
795 break; | 795 break; |
796 } | 796 } |
797 } | 797 } |
798 | 798 |
799 // Histograms to compare the impact of alternate protocol over http | 799 // Histograms to compare the impact of alternate protocol over http |
800 // traffic: when spdy is used vs. when http is used. | 800 // traffic: when spdy is used vs. when http is used. |
801 if (scheme_type == URLPattern::SCHEME_HTTP && | 801 if (scheme_type == URLPattern::SCHEME_HTTP && |
802 navigation_state->was_alternate_protocol_available()) { | 802 load_times->was_alternate_protocol_available()) { |
803 if (!navigation_state->was_npn_negotiated()) { | 803 if (!load_times->was_npn_negotiated()) { |
804 // This means that even there is alternate protocols for npn_http or | 804 // This means that even there is alternate protocols for npn_http or |
805 // npn_spdy, they are not taken (due to the base::FieldTrial). | 805 // npn_spdy, they are not taken (due to the base::FieldTrial). |
806 switch (load_type) { | 806 switch (load_type) { |
807 case NavigationState::LINK_LOAD_NORMAL: | 807 case NavigationState::LINK_LOAD_NORMAL: |
808 PLT_HISTOGRAM( | 808 PLT_HISTOGRAM( |
809 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_http", | 809 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_http", |
810 start_to_finish_all_loads); | 810 start_to_finish_all_loads); |
811 PLT_HISTOGRAM( | 811 PLT_HISTOGRAM( |
812 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_http", | 812 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_http", |
813 start_to_commit); | 813 start_to_commit); |
814 break; | 814 break; |
815 case NavigationState::NORMAL_LOAD: | 815 case NavigationState::NORMAL_LOAD: |
816 PLT_HISTOGRAM( | 816 PLT_HISTOGRAM( |
817 "PLT.StartToFinish_NormalLoad_AlternateProtocol_http", | 817 "PLT.StartToFinish_NormalLoad_AlternateProtocol_http", |
818 start_to_finish_all_loads); | 818 start_to_finish_all_loads); |
819 PLT_HISTOGRAM( | 819 PLT_HISTOGRAM( |
820 "PLT.StartToCommit_NormalLoad_AlternateProtocol_http", | 820 "PLT.StartToCommit_NormalLoad_AlternateProtocol_http", |
821 start_to_commit); | 821 start_to_commit); |
822 break; | 822 break; |
823 default: | 823 default: |
824 break; | 824 break; |
825 } | 825 } |
826 } else if (navigation_state->was_fetched_via_spdy()) { | 826 } else if (load_times->was_fetched_via_spdy()) { |
827 switch (load_type) { | 827 switch (load_type) { |
828 case NavigationState::LINK_LOAD_NORMAL: | 828 case NavigationState::LINK_LOAD_NORMAL: |
829 PLT_HISTOGRAM( | 829 PLT_HISTOGRAM( |
830 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_spdy", | 830 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_spdy", |
831 start_to_finish_all_loads); | 831 start_to_finish_all_loads); |
832 PLT_HISTOGRAM( | 832 PLT_HISTOGRAM( |
833 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_spdy", | 833 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_spdy", |
834 start_to_commit); | 834 start_to_commit); |
835 break; | 835 break; |
836 case NavigationState::NORMAL_LOAD: | 836 case NavigationState::NORMAL_LOAD: |
837 PLT_HISTOGRAM( | 837 PLT_HISTOGRAM( |
838 "PLT.StartToFinish_NormalLoad_AlternateProtocol_spdy", | 838 "PLT.StartToFinish_NormalLoad_AlternateProtocol_spdy", |
839 start_to_finish_all_loads); | 839 start_to_finish_all_loads); |
840 PLT_HISTOGRAM( | 840 PLT_HISTOGRAM( |
841 "PLT.StartToCommit_NormalLoad_AlternateProtocol_spdy", | 841 "PLT.StartToCommit_NormalLoad_AlternateProtocol_spdy", |
842 start_to_commit); | 842 start_to_commit); |
843 break; | 843 break; |
844 default: | 844 default: |
845 break; | 845 break; |
846 } | 846 } |
847 } | 847 } |
848 } | 848 } |
849 } | 849 } |
850 } | 850 } |
851 | 851 |
852 // Record SpdyCwnd field trial results. | 852 // Record SpdyCwnd field trial results. |
853 if (navigation_state->was_fetched_via_spdy()) { | 853 if (load_times->was_fetched_via_spdy()) { |
854 switch (load_type) { | 854 switch (load_type) { |
855 case NavigationState::LINK_LOAD_NORMAL: | 855 case NavigationState::LINK_LOAD_NORMAL: |
856 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 856 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
857 "PLT.BeginToFinish_LinkLoadNormal", "SpdyCwnd"), | 857 "PLT.BeginToFinish_LinkLoadNormal", "SpdyCwnd"), |
858 begin_to_finish_all_loads); | 858 begin_to_finish_all_loads); |
859 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 859 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
860 "PLT.StartToFinish_LinkLoadNormal", "SpdyCwnd"), | 860 "PLT.StartToFinish_LinkLoadNormal", "SpdyCwnd"), |
861 start_to_finish_all_loads); | 861 start_to_finish_all_loads); |
862 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 862 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
863 "PLT.StartToCommit_LinkLoadNormal", "SpdyCwnd"), | 863 "PLT.StartToCommit_LinkLoadNormal", "SpdyCwnd"), |
864 start_to_commit); | 864 start_to_commit); |
865 break; | 865 break; |
866 case NavigationState::NORMAL_LOAD: | 866 case NavigationState::NORMAL_LOAD: |
867 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 867 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
868 "PLT.BeginToFinish_NormalLoad", "SpdyCwnd"), | 868 "PLT.BeginToFinish_NormalLoad", "SpdyCwnd"), |
869 begin_to_finish_all_loads); | 869 begin_to_finish_all_loads); |
870 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 870 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
871 "PLT.StartToFinish_NormalLoad", "SpdyCwnd"), | 871 "PLT.StartToFinish_NormalLoad", "SpdyCwnd"), |
872 start_to_finish_all_loads); | 872 start_to_finish_all_loads); |
873 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 873 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
874 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), | 874 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), |
875 start_to_commit); | 875 start_to_commit); |
876 break; | 876 break; |
877 default: | 877 default: |
878 break; | 878 break; |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 // Record page load time and abandonment rates for proxy cases. | 882 // Record page load time and abandonment rates for proxy cases. |
883 if (navigation_state->was_fetched_via_proxy()) { | 883 if (load_times->was_fetched_via_proxy()) { |
884 if (scheme_type == URLPattern::SCHEME_HTTPS) { | 884 if (scheme_type == URLPattern::SCHEME_HTTPS) { |
885 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); | 885 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); |
886 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", | 886 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", |
887 abandoned_page ? 1 : 0, 2); | 887 abandoned_page ? 1 : 0, 2); |
888 } else { | 888 } else { |
889 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); | 889 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); |
890 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); | 890 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); |
891 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", | 891 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", |
892 abandoned_page ? 1 : 0, 2); | 892 abandoned_page ? 1 : 0, 2); |
893 } | 893 } |
(...skipping 12 matching lines...) Expand all Loading... |
906 } | 906 } |
907 } | 907 } |
908 | 908 |
909 // Site isolation metrics. | 909 // Site isolation metrics. |
910 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", | 910 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", |
911 cross_origin_access_count_); | 911 cross_origin_access_count_); |
912 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", | 912 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", |
913 same_origin_access_count_); | 913 same_origin_access_count_); |
914 | 914 |
915 // Log the PLT to the info log. | 915 // Log the PLT to the info log. |
916 LogPageLoadTime(navigation_state, frame->dataSource()); | 916 LogPageLoadTime(load_times, frame->dataSource()); |
917 | 917 |
918 // Record prerendering histograms. | 918 // Record prerendering histograms. |
919 prerender::PrerenderHelper::RecordHistograms(render_view(), | 919 prerender::PrerenderHelper::RecordHistograms(render_view(), |
920 finish_all_loads, | 920 finish_all_loads, |
921 begin_to_finish_all_loads); | 921 begin_to_finish_all_loads); |
922 | 922 |
923 // Since there are currently no guarantees that renderer histograms will be | 923 // Since there are currently no guarantees that renderer histograms will be |
924 // sent to the browser, we initiate a PostTask here to be sure that we send | 924 // sent to the browser, we initiate a PostTask here to be sure that we send |
925 // the histograms we generated. Without this call, pages that don't have an | 925 // the histograms we generated. Without this call, pages that don't have an |
926 // on-close-handler might generate data that is lost when the renderer is | 926 // on-close-handler might generate data that is lost when the renderer is |
(...skipping 15 matching lines...) Expand all Loading... |
942 } | 942 } |
943 | 943 |
944 void PageLoadHistograms::ClosePage() { | 944 void PageLoadHistograms::ClosePage() { |
945 // TODO(davemoore) This code should be removed once willClose() gets | 945 // TODO(davemoore) This code should be removed once willClose() gets |
946 // called when a page is destroyed. page_load_histograms_.Dump() is safe | 946 // called when a page is destroyed. page_load_histograms_.Dump() is safe |
947 // to call multiple times for the same frame, but it will simplify things. | 947 // to call multiple times for the same frame, but it will simplify things. |
948 Dump(render_view()->GetWebView()->mainFrame()); | 948 Dump(render_view()->GetWebView()->mainFrame()); |
949 ResetCrossFramePropertyAccess(); | 949 ResetCrossFramePropertyAccess(); |
950 } | 950 } |
951 | 951 |
952 void PageLoadHistograms::LogPageLoadTime(const NavigationState* state, | 952 void PageLoadHistograms::LogPageLoadTime( |
953 const WebDataSource* ds) const { | 953 const NavigationState::LoadTimes* load_times, |
| 954 const WebDataSource* ds) const { |
954 // Because this function gets called on every page load, | 955 // Because this function gets called on every page load, |
955 // take extra care to optimize it away if logging is turned off. | 956 // take extra care to optimize it away if logging is turned off. |
956 if (logging::LOG_INFO < logging::GetMinLogLevel()) | 957 if (logging::LOG_INFO < logging::GetMinLogLevel()) |
957 return; | 958 return; |
958 | 959 |
959 DCHECK(state); | 960 DCHECK(load_times); |
960 DCHECK(ds); | 961 DCHECK(ds); |
961 GURL url(ds->request().url()); | 962 GURL url(ds->request().url()); |
962 Time start = state->start_load_time(); | 963 Time start = load_times->start_load_time(); |
963 Time finish = state->finish_load_time(); | 964 Time finish = load_times->finish_load_time(); |
964 // TODO(mbelshe): should we log more stats? | 965 // TODO(mbelshe): should we log more stats? |
965 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 966 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
966 << url.spec(); | 967 << url.spec(); |
967 } | 968 } |
OLD | NEW |