Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 name, websearch_chrome_joint_experiment_id); \ | 103 name, websearch_chrome_joint_experiment_id); \ |
| 104 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \ | 104 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \ |
| 105 } \ | 105 } \ |
| 106 } \ | 106 } \ |
| 107 PltHistogramWithGwsPreview(name, sample, is_preview, \ | 107 PltHistogramWithGwsPreview(name, sample, is_preview, \ |
| 108 websearch_chrome_joint_experiment_id); \ | 108 websearch_chrome_joint_experiment_id); \ |
| 109 } | 109 } |
| 110 | 110 |
| 111 // In addition to PLT_HISTOGRAM, add the *_DataReductionProxy variant | 111 // In addition to PLT_HISTOGRAM, add the *_DataReductionProxy variant |
| 112 // conditionally. This macro runs only in one thread. | 112 // conditionally. This macro runs only in one thread. |
| 113 #define PLT_HISTOGRAM_DRP(name, sample, data_reduction_proxy_was_used) \ | 113 #define PLT_HISTOGRAM_DRP( \ |
| 114 name, sample, data_reduction_proxy_was_used, scheme_type) \ | |
| 114 do { \ | 115 do { \ |
| 115 static base::HistogramBase* counter(NULL); \ | 116 static base::HistogramBase* counter(NULL); \ |
| 116 static base::HistogramBase* drp_counter(NULL); \ | 117 static base::HistogramBase* drp_counter(NULL); \ |
| 117 if (!counter) { \ | 118 if (!counter) { \ |
| 118 DCHECK(drp_counter == NULL); \ | 119 DCHECK(drp_counter == NULL); \ |
| 119 counter = base::Histogram::FactoryTimeGet( \ | 120 counter = base::Histogram::FactoryTimeGet( \ |
| 120 name, kPLTMin(), kPLTMax(), kPLTCount, \ | 121 name, kPLTMin(), kPLTMax(), kPLTCount, \ |
| 121 base::Histogram::kUmaTargetedHistogramFlag); \ | 122 base::Histogram::kUmaTargetedHistogramFlag); \ |
| 122 } \ | 123 } \ |
| 123 counter->AddTime(sample); \ | 124 counter->AddTime(sample); \ |
| 124 if (!data_reduction_proxy_was_used) break; \ | 125 if (!data_reduction_proxy_was_used) break; \ |
| 125 if (!drp_counter) { \ | 126 if (!drp_counter) { \ |
| 126 drp_counter = base::Histogram::FactoryTimeGet( \ | 127 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { \ |
|
ppi
2014/11/03 10:49:17
Afaiu |drp_counter| is a static variable, so we'll
jeremyim
2014/11/03 18:46:16
Thanks for catching this! Updated to add a new sta
| |
| 127 std::string(name) + "_DataReductionProxy", \ | 128 drp_counter = base::Histogram::FactoryTimeGet( \ |
| 128 kPLTMin(), kPLTMax(), kPLTCount, \ | 129 std::string(name) + "_DataReductionProxy", \ |
| 129 base::Histogram::kUmaTargetedHistogramFlag); \ | 130 kPLTMin(), kPLTMax(), kPLTCount, \ |
| 131 base::Histogram::kUmaTargetedHistogramFlag); \ | |
| 132 } else { \ | |
| 133 drp_counter = base::Histogram::FactoryTimeGet( \ | |
| 134 std::string(name) + "_HTTPS_DataReductionProxy", \ | |
| 135 kPLTMin(), kPLTMax(), kPLTCount, \ | |
| 136 base::Histogram::kUmaTargetedHistogramFlag); \ | |
| 137 } \ | |
| 130 } \ | 138 } \ |
| 131 drp_counter->AddTime(sample); \ | 139 drp_counter->AddTime(sample); \ |
| 132 } while (0) | 140 } while (0) |
| 133 | 141 |
| 134 // Returns the scheme type of the given URL if its type is one for which we | 142 // Returns the scheme type of the given URL if its type is one for which we |
| 135 // dump page load histograms. Otherwise returns NULL. | 143 // dump page load histograms. Otherwise returns NULL. |
| 136 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { | 144 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { |
| 137 if (url.SchemeIs("http")) | 145 if (url.SchemeIs("http")) |
| 138 return URLPattern::SCHEME_HTTP; | 146 return URLPattern::SCHEME_HTTP; |
| 139 else if (url.SchemeIs("https")) | 147 else if (url.SchemeIs("https")) |
| 140 return URLPattern::SCHEME_HTTPS; | 148 return URLPattern::SCHEME_HTTPS; |
| 141 return static_cast<URLPattern::SchemeMasks>(0); | 149 return static_cast<URLPattern::SchemeMasks>(0); |
| 142 } | 150 } |
| 143 | 151 |
| 144 // Helper function to check for string in 'via' header. Returns true if | 152 // Helper function to check for string in 'via' header. Returns true if |
| 145 // |via_value| is one of the values listed in the Via header. | 153 // |via_value| is one of the values listed in the Via header. |
| 146 bool ViaHeaderContains(WebFrame* frame, const std::string& via_value) { | 154 bool ViaHeaderContains(WebFrame* frame, const std::string& via_value) { |
| 147 const char kViaHeaderName[] = "Via"; | 155 const char kViaHeaderName[] = "Via"; |
| 148 std::vector<std::string> values; | 156 std::vector<std::string> values; |
| 149 // Multiple via headers have already been coalesced and hence each value | 157 // Multiple via headers have already been coalesced and hence each value |
| 150 // separated by a comma corresponds to a proxy. The value added by a proxy is | 158 // separated by a comma corresponds to a proxy. The value added by a proxy is |
| 151 // not expected to contain any commas. | 159 // not expected to contain any commas. |
| 152 // Example., Via: 1.0 Compression proxy, 1.1 Google Instant Proxy Preview | 160 // Example., Via: 1.0 Compression proxy, 1.1 Google Instant Proxy Preview |
| 153 base::SplitString( | 161 base::SplitString( |
| 154 frame->dataSource()->response().httpHeaderField(kViaHeaderName).utf8(), | 162 frame->dataSource()->response().httpHeaderField(kViaHeaderName).utf8(), |
| 155 ',', &values); | 163 ',', &values); |
| 156 return std::find(values.begin(), values.end(), via_value) != values.end(); | 164 return std::find(values.begin(), values.end(), via_value) != values.end(); |
| 157 } | 165 } |
| 158 | 166 |
| 159 // Returns true if the data reduction proxy was used. Note, this function will | |
| 160 // produce a false positive if a page is fetched using SPDY and using a proxy, | |
| 161 // and the data reduction proxy's via value is added to the Via header. | |
| 162 // TODO(bengr): Plumb the hostname of the proxy and check if it matches | |
| 163 // |SPDY_PROXY_AUTH_ORIGIN|. | |
| 164 bool DataReductionProxyWasUsed(WebFrame* frame) { | |
| 165 DocumentState* document_state = | |
| 166 DocumentState::FromDataSource(frame->dataSource()); | |
| 167 if (!document_state->was_fetched_via_proxy()) | |
| 168 return false; | |
| 169 | |
| 170 std::string via_header = | |
| 171 base::UTF16ToUTF8(frame->dataSource()->response().httpHeaderField("Via")); | |
| 172 | |
| 173 if (via_header.empty()) | |
| 174 return false; | |
| 175 std::string headers = "HTTP/1.1 200 OK\nVia: " + via_header + "\n\n"; | |
| 176 // Produce raw headers, expected by the |HttpResponseHeaders| constructor. | |
| 177 std::replace(headers.begin(), headers.end(), '\n', '\0'); | |
| 178 scoped_refptr<net::HttpResponseHeaders> response_headers( | |
| 179 new net::HttpResponseHeaders(headers)); | |
| 180 return data_reduction_proxy::HasDataReductionProxyViaHeader( | |
| 181 response_headers.get(), NULL); | |
| 182 } | |
| 183 | |
| 184 // Returns true if the provided URL is a referrer string that came from | 167 // Returns true if the provided URL is a referrer string that came from |
| 185 // a Google Web Search results page. This is a little non-deterministic | 168 // a Google Web Search results page. This is a little non-deterministic |
| 186 // because desktop and mobile websearch differ and sometimes just provide | 169 // because desktop and mobile websearch differ and sometimes just provide |
| 187 // http://www.google.com/ as the referrer. In the case of /url we can be sure | 170 // http://www.google.com/ as the referrer. In the case of /url we can be sure |
| 188 // that it came from websearch but we will be generous and allow for cases | 171 // that it came from websearch but we will be generous and allow for cases |
| 189 // where a non-Google URL was provided a bare Google URL as a referrer. | 172 // where a non-Google URL was provided a bare Google URL as a referrer. |
| 190 // The domain validation matches the code used by the prerenderer for similar | 173 // The domain validation matches the code used by the prerenderer for similar |
| 191 // purposes. | 174 // purposes. |
| 192 // TODO(pmeenan): Remove the fuzzy logic when the referrer is reliable | 175 // TODO(pmeenan): Remove the fuzzy logic when the referrer is reliable |
| 193 bool IsFromGoogleSearchResult(const GURL& url, const GURL& referrer) { | 176 bool IsFromGoogleSearchResult(const GURL& url, const GURL& referrer) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 220 if (0 < experiment_id && experiment_id <= kMaxExperimentID) | 203 if (0 < experiment_id && experiment_id <= kMaxExperimentID) |
| 221 return experiment_id; | 204 return experiment_id; |
| 222 return kNoExperiment; | 205 return kNoExperiment; |
| 223 } | 206 } |
| 224 | 207 |
| 225 void DumpHistograms(const WebPerformance& performance, | 208 void DumpHistograms(const WebPerformance& performance, |
| 226 DocumentState* document_state, | 209 DocumentState* document_state, |
| 227 bool data_reduction_proxy_was_used, | 210 bool data_reduction_proxy_was_used, |
| 228 bool came_from_websearch, | 211 bool came_from_websearch, |
| 229 int websearch_chrome_joint_experiment_id, | 212 int websearch_chrome_joint_experiment_id, |
| 230 bool is_preview) { | 213 bool is_preview, |
| 214 URLPattern::SchemeMasks scheme_type) { | |
| 231 // This function records new histograms based on the Navigation Timing | 215 // This function records new histograms based on the Navigation Timing |
| 232 // records. As such, the histograms should not depend on the deprecated timing | 216 // records. As such, the histograms should not depend on the deprecated timing |
| 233 // information collected in DocumentState. However, here for some reason we | 217 // information collected in DocumentState. However, here for some reason we |
| 234 // check if document_state->request_time() is null. TODO(ppi): find out why | 218 // check if document_state->request_time() is null. TODO(ppi): find out why |
| 235 // and remove DocumentState from the parameter list. | 219 // and remove DocumentState from the parameter list. |
| 236 Time request = document_state->request_time(); | 220 Time request = document_state->request_time(); |
| 237 | 221 |
| 238 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); | 222 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); |
| 239 Time redirect_start = Time::FromDoubleT(performance.redirectStart()); | 223 Time redirect_start = Time::FromDoubleT(performance.redirectStart()); |
| 240 Time redirect_end = Time::FromDoubleT(performance.redirectEnd()); | 224 Time redirect_end = Time::FromDoubleT(performance.redirectEnd()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in | 256 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in |
| 273 // http://crbug.com/112006. | 257 // http://crbug.com/112006. |
| 274 // DCHECK(!load_event_start.is_null()); | 258 // DCHECK(!load_event_start.is_null()); |
| 275 // DCHECK(!load_event_end.is_null()); | 259 // DCHECK(!load_event_end.is_null()); |
| 276 | 260 |
| 277 if (document_state->web_timing_histograms_recorded()) | 261 if (document_state->web_timing_histograms_recorded()) |
| 278 return; | 262 return; |
| 279 document_state->set_web_timing_histograms_recorded(true); | 263 document_state->set_web_timing_histograms_recorded(true); |
| 280 | 264 |
| 281 if (!redirect_start.is_null() && !redirect_end.is_null()) { | 265 if (!redirect_start.is_null() && !redirect_end.is_null()) { |
| 282 PLT_HISTOGRAM_DRP("PLT.NT_Redirect", redirect_end - redirect_start, | 266 PLT_HISTOGRAM_DRP("PLT.NT_Redirect", |
| 283 data_reduction_proxy_was_used); | 267 redirect_end - redirect_start, |
| 268 data_reduction_proxy_was_used, | |
| 269 scheme_type); | |
| 284 PLT_HISTOGRAM_DRP( | 270 PLT_HISTOGRAM_DRP( |
| 285 "PLT.NT_DelayBeforeFetchRedirect", | 271 "PLT.NT_DelayBeforeFetchRedirect", |
| 286 (fetch_start - navigation_start) - (redirect_end - redirect_start), | 272 (fetch_start - navigation_start) - (redirect_end - redirect_start), |
| 287 data_reduction_proxy_was_used); | 273 data_reduction_proxy_was_used, |
| 274 scheme_type); | |
| 288 } else { | 275 } else { |
| 289 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeFetch", | 276 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeFetch", |
| 290 fetch_start - navigation_start, | 277 fetch_start - navigation_start, |
| 291 data_reduction_proxy_was_used); | 278 data_reduction_proxy_was_used, |
| 279 scheme_type); | |
| 292 } | 280 } |
| 293 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeDomainLookup", | 281 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeDomainLookup", |
| 294 domain_lookup_start - fetch_start, | 282 domain_lookup_start - fetch_start, |
| 295 data_reduction_proxy_was_used); | 283 data_reduction_proxy_was_used, |
| 284 scheme_type); | |
| 296 PLT_HISTOGRAM_DRP("PLT.NT_DomainLookup", | 285 PLT_HISTOGRAM_DRP("PLT.NT_DomainLookup", |
| 297 domain_lookup_end - domain_lookup_start, | 286 domain_lookup_end - domain_lookup_start, |
| 298 data_reduction_proxy_was_used); | 287 data_reduction_proxy_was_used, |
| 288 scheme_type); | |
| 299 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeConnect", | 289 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeConnect", |
| 300 connect_start - domain_lookup_end, | 290 connect_start - domain_lookup_end, |
| 301 data_reduction_proxy_was_used); | 291 data_reduction_proxy_was_used, |
| 302 PLT_HISTOGRAM_DRP("PLT.NT_Connect", connect_end - connect_start, | 292 scheme_type); |
| 303 data_reduction_proxy_was_used); | 293 PLT_HISTOGRAM_DRP("PLT.NT_Connect", |
| 294 connect_end - connect_start, | |
| 295 data_reduction_proxy_was_used, | |
| 296 scheme_type); | |
| 304 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeRequest", | 297 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeRequest", |
| 305 request_start - connect_end, | 298 request_start - connect_end, |
| 306 data_reduction_proxy_was_used); | 299 data_reduction_proxy_was_used, |
| 307 PLT_HISTOGRAM_DRP("PLT.NT_Request", response_start - request_start, | 300 scheme_type); |
| 308 data_reduction_proxy_was_used); | 301 PLT_HISTOGRAM_DRP("PLT.NT_Request", |
| 309 PLT_HISTOGRAM_DRP("PLT.NT_Response", response_end - response_start, | 302 response_start - request_start, |
| 310 data_reduction_proxy_was_used); | 303 data_reduction_proxy_was_used, |
| 304 scheme_type); | |
| 305 PLT_HISTOGRAM_DRP("PLT.NT_Response", | |
| 306 response_end - response_start, | |
| 307 data_reduction_proxy_was_used, | |
| 308 scheme_type); | |
| 311 | 309 |
| 312 if (!dom_loading.is_null()) { | 310 if (!dom_loading.is_null()) { |
| 313 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeDomLoading", | 311 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeDomLoading", |
| 314 dom_loading - response_start, | 312 dom_loading - response_start, |
| 315 data_reduction_proxy_was_used); | 313 data_reduction_proxy_was_used, |
| 314 scheme_type); | |
| 316 } | 315 } |
| 317 if (!dom_interactive.is_null() && !dom_loading.is_null()) { | 316 if (!dom_interactive.is_null() && !dom_loading.is_null()) { |
| 318 PLT_HISTOGRAM_DRP("PLT.NT_DomLoading", | 317 PLT_HISTOGRAM_DRP("PLT.NT_DomLoading", |
| 319 dom_interactive - dom_loading, | 318 dom_interactive - dom_loading, |
| 320 data_reduction_proxy_was_used); | 319 data_reduction_proxy_was_used, |
| 320 scheme_type); | |
| 321 } | 321 } |
| 322 if (!dom_content_loaded_start.is_null() && !dom_interactive.is_null()) { | 322 if (!dom_content_loaded_start.is_null() && !dom_interactive.is_null()) { |
| 323 PLT_HISTOGRAM_DRP("PLT.NT_DomInteractive", | 323 PLT_HISTOGRAM_DRP("PLT.NT_DomInteractive", |
| 324 dom_content_loaded_start - dom_interactive, | 324 dom_content_loaded_start - dom_interactive, |
| 325 data_reduction_proxy_was_used); | 325 data_reduction_proxy_was_used, |
| 326 scheme_type); | |
| 326 } | 327 } |
| 327 if (!dom_content_loaded_start.is_null() && | 328 if (!dom_content_loaded_start.is_null() && |
| 328 !dom_content_loaded_end.is_null() ) { | 329 !dom_content_loaded_end.is_null() ) { |
| 329 PLT_HISTOGRAM_DRP("PLT.NT_DomContentLoaded", | 330 PLT_HISTOGRAM_DRP("PLT.NT_DomContentLoaded", |
| 330 dom_content_loaded_end - dom_content_loaded_start, | 331 dom_content_loaded_end - dom_content_loaded_start, |
| 331 data_reduction_proxy_was_used); | 332 data_reduction_proxy_was_used, |
| 333 scheme_type); | |
| 332 } | 334 } |
| 333 if (!dom_content_loaded_end.is_null() && !load_event_start.is_null()) { | 335 if (!dom_content_loaded_end.is_null() && !load_event_start.is_null()) { |
| 334 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeLoadEvent", | 336 PLT_HISTOGRAM_DRP("PLT.NT_DelayBeforeLoadEvent", |
| 335 load_event_start - dom_content_loaded_end, | 337 load_event_start - dom_content_loaded_end, |
| 336 data_reduction_proxy_was_used); | 338 data_reduction_proxy_was_used, |
| 339 scheme_type); | |
| 337 } | 340 } |
| 338 | 341 |
| 339 // TODO(simonjam): There is no way to distinguish between abandonment and | 342 // TODO(simonjam): There is no way to distinguish between abandonment and |
| 340 // intentional Javascript navigation before the load event fires. | 343 // intentional Javascript navigation before the load event fires. |
| 341 // TODO(dominich): Load type breakdown | 344 // TODO(dominich): Load type breakdown |
| 342 if (!load_event_start.is_null()) { | 345 if (!load_event_start.is_null()) { |
| 343 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc", | 346 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc", |
| 344 load_event_start - begin, | 347 load_event_start - begin, |
| 345 came_from_websearch, | 348 came_from_websearch, |
| 346 websearch_chrome_joint_experiment_id, | 349 websearch_chrome_joint_experiment_id, |
| 347 is_preview); | 350 is_preview); |
| 348 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc", | 351 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc", |
| 349 load_event_start - response_start, | 352 load_event_start - response_start, |
| 350 came_from_websearch, | 353 came_from_websearch, |
| 351 websearch_chrome_joint_experiment_id, | 354 websearch_chrome_joint_experiment_id, |
| 352 is_preview); | 355 is_preview); |
| 353 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc", | 356 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc", |
| 354 load_event_start - navigation_start, | 357 load_event_start - navigation_start, |
| 355 came_from_websearch, | 358 came_from_websearch, |
| 356 websearch_chrome_joint_experiment_id, | 359 websearch_chrome_joint_experiment_id, |
| 357 is_preview); | 360 is_preview); |
| 358 if (data_reduction_proxy_was_used) { | 361 if (data_reduction_proxy_was_used) { |
| 359 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_DataReductionProxy", | 362 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
| 360 load_event_start - begin); | 363 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_DataReductionProxy", |
| 361 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_DataReductionProxy", | 364 load_event_start - begin); |
| 362 load_event_start - response_start); | 365 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_DataReductionProxy", |
| 363 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_DataReductionProxy", | 366 load_event_start - response_start); |
| 364 load_event_start - navigation_start); | 367 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_DataReductionProxy", |
| 368 load_event_start - navigation_start); | |
| 369 } else { | |
| 370 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_HTTPS_DataReductionProxy", | |
| 371 load_event_start - begin); | |
| 372 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_HTTPS_DataReductionProxy", | |
| 373 load_event_start - response_start); | |
| 374 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_HTTPS_DataReductionProxy", | |
| 375 load_event_start - navigation_start); | |
| 376 } | |
| 365 } | 377 } |
| 366 } | 378 } |
| 367 if (!load_event_end.is_null()) { | 379 if (!load_event_end.is_null()) { |
| 368 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish", | 380 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish", |
| 369 load_event_end - begin, | 381 load_event_end - begin, |
| 370 came_from_websearch, | 382 came_from_websearch, |
| 371 websearch_chrome_joint_experiment_id, | 383 websearch_chrome_joint_experiment_id, |
| 372 is_preview); | 384 is_preview); |
| 373 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish", | 385 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish", |
| 374 load_event_end - response_start, | 386 load_event_end - response_start, |
| 375 came_from_websearch, | 387 came_from_websearch, |
| 376 websearch_chrome_joint_experiment_id, | 388 websearch_chrome_joint_experiment_id, |
| 377 is_preview); | 389 is_preview); |
| 378 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish", | 390 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish", |
| 379 load_event_end - navigation_start, | 391 load_event_end - navigation_start, |
| 380 came_from_websearch, | 392 came_from_websearch, |
| 381 websearch_chrome_joint_experiment_id, | 393 websearch_chrome_joint_experiment_id, |
| 382 is_preview); | 394 is_preview); |
| 383 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", | 395 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", |
| 384 load_event_end - request_start, | 396 load_event_end - request_start, |
| 385 came_from_websearch, | 397 came_from_websearch, |
| 386 websearch_chrome_joint_experiment_id, | 398 websearch_chrome_joint_experiment_id, |
| 387 is_preview); | 399 is_preview); |
| 388 if (data_reduction_proxy_was_used) { | 400 if (data_reduction_proxy_was_used) { |
| 389 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", | 401 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
| 390 load_event_end - begin); | 402 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", |
| 391 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", | 403 load_event_end - begin); |
| 392 load_event_end - response_start); | 404 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", |
| 393 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", | 405 load_event_end - response_start); |
| 394 load_event_end - navigation_start); | 406 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", |
| 395 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", | 407 load_event_end - navigation_start); |
| 396 load_event_end - request_start); | 408 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", |
| 409 load_event_end - request_start); | |
| 410 } else { | |
| 411 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", | |
| 412 load_event_end - begin); | |
| 413 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", | |
| 414 load_event_end - response_start); | |
| 415 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", | |
| 416 load_event_end - navigation_start); | |
| 417 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", | |
| 418 load_event_end - request_start); | |
| 419 } | |
| 397 } | 420 } |
| 398 } | 421 } |
| 399 if (!load_event_start.is_null() && !load_event_end.is_null()) { | 422 if (!load_event_start.is_null() && !load_event_end.is_null()) { |
| 400 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", | 423 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", |
| 401 load_event_end - load_event_start); | 424 load_event_end - load_event_start); |
| 402 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", | 425 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", |
| 403 load_event_end - load_event_start, | 426 load_event_end - load_event_start, |
| 404 data_reduction_proxy_was_used); | 427 data_reduction_proxy_was_used, |
| 428 scheme_type); | |
| 405 | 429 |
| 406 if (data_reduction_proxy_was_used) | 430 if (data_reduction_proxy_was_used) { |
| 407 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_DataReductionProxy", | 431 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
| 408 load_event_end - load_event_start); | 432 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_DataReductionProxy", |
| 433 load_event_end - load_event_start); | |
| 434 } else { | |
| 435 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_HTTPS_DataReductionProxy", | |
| 436 load_event_end - load_event_start); | |
| 437 } | |
| 438 } | |
| 409 } | 439 } |
| 410 if (!dom_content_loaded_start.is_null()) { | 440 if (!dom_content_loaded_start.is_null()) { |
| 411 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", | 441 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", |
| 412 dom_content_loaded_start - navigation_start, | 442 dom_content_loaded_start - navigation_start, |
| 413 came_from_websearch, | 443 came_from_websearch, |
| 414 websearch_chrome_joint_experiment_id, | 444 websearch_chrome_joint_experiment_id, |
| 415 is_preview); | 445 is_preview); |
| 416 if (data_reduction_proxy_was_used) | 446 if (data_reduction_proxy_was_used) { |
| 417 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", | 447 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
| 418 dom_content_loaded_start - navigation_start); | 448 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", |
| 449 dom_content_loaded_start - navigation_start); | |
| 450 } else { | |
| 451 PLT_HISTOGRAM( | |
| 452 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", | |
| 453 dom_content_loaded_start - navigation_start); | |
| 454 } | |
| 455 } | |
| 419 } | 456 } |
| 420 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", | 457 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", |
| 421 response_start - begin, | 458 response_start - begin, |
| 422 came_from_websearch, | 459 came_from_websearch, |
| 423 websearch_chrome_joint_experiment_id, | 460 websearch_chrome_joint_experiment_id, |
| 424 is_preview); | 461 is_preview); |
| 425 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", | 462 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", |
| 426 request_start - navigation_start, | 463 request_start - navigation_start, |
| 427 came_from_websearch, | 464 came_from_websearch, |
| 428 websearch_chrome_joint_experiment_id, | 465 websearch_chrome_joint_experiment_id, |
| 429 is_preview); | 466 is_preview); |
| 430 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit", | 467 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit", |
| 431 response_start - request_start, | 468 response_start - request_start, |
| 432 came_from_websearch, | 469 came_from_websearch, |
| 433 websearch_chrome_joint_experiment_id, | 470 websearch_chrome_joint_experiment_id, |
| 434 is_preview); | 471 is_preview); |
| 435 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit", | 472 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit", |
| 436 response_start - navigation_start, | 473 response_start - navigation_start, |
| 437 came_from_websearch, | 474 came_from_websearch, |
| 438 websearch_chrome_joint_experiment_id, | 475 websearch_chrome_joint_experiment_id, |
| 439 is_preview); | 476 is_preview); |
| 440 if (data_reduction_proxy_was_used) { | 477 if (data_reduction_proxy_was_used) { |
| 441 PLT_HISTOGRAM("PLT.PT_BeginToCommit_DataReductionProxy", | 478 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
| 442 response_start - begin); | 479 PLT_HISTOGRAM("PLT.PT_BeginToCommit_DataReductionProxy", |
| 443 PLT_HISTOGRAM("PLT.PT_RequestToStart_DataReductionProxy", | 480 response_start - begin); |
| 444 request_start - navigation_start); | 481 PLT_HISTOGRAM("PLT.PT_RequestToStart_DataReductionProxy", |
| 445 PLT_HISTOGRAM("PLT.PT_StartToCommit_DataReductionProxy", | 482 request_start - navigation_start); |
| 446 response_start - request_start); | 483 PLT_HISTOGRAM("PLT.PT_StartToCommit_DataReductionProxy", |
| 447 PLT_HISTOGRAM("PLT.PT_RequestToCommit_DataReductionProxy", | 484 response_start - request_start); |
| 448 response_start - navigation_start); | 485 PLT_HISTOGRAM("PLT.PT_RequestToCommit_DataReductionProxy", |
| 486 response_start - navigation_start); | |
| 487 } else { | |
| 488 PLT_HISTOGRAM("PLT.PT_BeginToCommit_HTTPS_DataReductionProxy", | |
| 489 response_start - begin); | |
| 490 PLT_HISTOGRAM("PLT.PT_RequestToStart_HTTPS_DataReductionProxy", | |
| 491 request_start - navigation_start); | |
| 492 PLT_HISTOGRAM("PLT.PT_StartToCommit_HTTPS_DataReductionProxy", | |
| 493 response_start - request_start); | |
| 494 PLT_HISTOGRAM("PLT.PT_RequestToCommit_HTTPS_DataReductionProxy", | |
| 495 response_start - navigation_start); | |
| 496 } | |
| 449 } | 497 } |
| 450 } | 498 } |
| 451 | 499 |
| 452 // These histograms are based on the timing information collected in | 500 // These histograms are based on the timing information collected in |
| 453 // DocumentState. They should be transitioned to equivalents based on the | 501 // DocumentState. They should be transitioned to equivalents based on the |
| 454 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not | 502 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not |
| 455 // needed. Please do not add new metrics based on DocumentState. | 503 // needed. Please do not add new metrics based on DocumentState. |
| 456 void DumpDeprecatedHistograms(const WebPerformance& performance, | 504 void DumpDeprecatedHistograms(const WebPerformance& performance, |
| 457 DocumentState* document_state, | 505 DocumentState* document_state, |
| 458 bool data_reduction_proxy_was_used, | 506 bool data_reduction_proxy_was_used, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 break; | 712 break; |
| 665 default: | 713 default: |
| 666 break; | 714 break; |
| 667 } | 715 } |
| 668 } | 716 } |
| 669 } | 717 } |
| 670 | 718 |
| 671 } // namespace | 719 } // namespace |
| 672 | 720 |
| 673 PageLoadHistograms::PageLoadHistograms(content::RenderView* render_view) | 721 PageLoadHistograms::PageLoadHistograms(content::RenderView* render_view) |
| 674 : content::RenderViewObserver(render_view) { | 722 : content::RenderViewObserver(render_view), |
| 723 data_reduction_proxy_params_(0) { | |
| 675 } | 724 } |
| 676 | 725 |
| 677 void PageLoadHistograms::Dump(WebFrame* frame) { | 726 void PageLoadHistograms::Dump(WebFrame* frame) { |
| 678 // We only dump histograms for main frames. | 727 // We only dump histograms for main frames. |
| 679 // In the future, it may be interesting to tag subframes and dump them too. | 728 // In the future, it may be interesting to tag subframes and dump them too. |
| 680 if (!frame || frame->parent()) | 729 if (!frame || frame->parent()) |
| 681 return; | 730 return; |
| 682 | 731 |
| 683 // Only dump for supported schemes. | 732 // Only dump for supported schemes. |
| 684 URLPattern::SchemeMasks scheme_type = | 733 URLPattern::SchemeMasks scheme_type = |
| 685 GetSupportedSchemeType(frame->document().url()); | 734 GetSupportedSchemeType(frame->document().url()); |
| 686 if (scheme_type == 0) | 735 if (scheme_type == 0) |
| 687 return; | 736 return; |
| 688 | 737 |
| 689 // Ignore multipart requests. | 738 // Ignore multipart requests. |
| 690 if (frame->dataSource()->response().isMultipartPayload()) | 739 if (frame->dataSource()->response().isMultipartPayload()) |
| 691 return; | 740 return; |
| 692 | 741 |
| 693 DocumentState* document_state = | 742 DocumentState* document_state = |
| 694 DocumentState::FromDataSource(frame->dataSource()); | 743 DocumentState::FromDataSource(frame->dataSource()); |
| 695 | 744 |
| 696 bool data_reduction_proxy_was_used = DataReductionProxyWasUsed(frame); | 745 bool data_reduction_proxy_was_used = |
| 746 data_reduction_proxy_params_.IsDataReductionProxy( | |
|
ppi
2014/11/03 10:49:17
I might be missing something - where |data_reducti
jeremyim
2014/11/03 18:46:16
This is set in the PLH constructor (line 723/728).
ppi
2014/11/04 16:12:42
Yup, but the flags are set to 0 there. In io_threa
jeremyim
2014/11/04 18:12:22
Updated to use the same base flags as io_thread; i
| |
| 747 document_state->proxy_server(), NULL); | |
| 697 bool came_from_websearch = | 748 bool came_from_websearch = |
| 698 IsFromGoogleSearchResult(frame->document().url(), | 749 IsFromGoogleSearchResult(frame->document().url(), |
| 699 GURL(frame->document().referrer())); | 750 GURL(frame->document().referrer())); |
| 700 int websearch_chrome_joint_experiment_id = kNoExperiment; | 751 int websearch_chrome_joint_experiment_id = kNoExperiment; |
| 701 bool is_preview = false; | 752 bool is_preview = false; |
| 702 if (came_from_websearch) { | 753 if (came_from_websearch) { |
| 703 websearch_chrome_joint_experiment_id = | 754 websearch_chrome_joint_experiment_id = |
| 704 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); | 755 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); |
| 705 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 756 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
| 706 } | 757 } |
| 707 | 758 |
| 708 // Metrics based on the timing information recorded for the Navigation Timing | 759 // Metrics based on the timing information recorded for the Navigation Timing |
| 709 // API - http://www.w3.org/TR/navigation-timing/. | 760 // API - http://www.w3.org/TR/navigation-timing/. |
| 710 DumpHistograms(frame->performance(), document_state, | 761 DumpHistograms(frame->performance(), document_state, |
| 711 data_reduction_proxy_was_used, | 762 data_reduction_proxy_was_used, |
| 712 came_from_websearch, | 763 came_from_websearch, |
| 713 websearch_chrome_joint_experiment_id, | 764 websearch_chrome_joint_experiment_id, |
| 714 is_preview); | 765 is_preview, |
| 766 scheme_type); | |
| 715 | 767 |
| 716 // Old metrics based on the timing information stored in DocumentState. These | 768 // Old metrics based on the timing information stored in DocumentState. These |
| 717 // are deprecated and should go away. | 769 // are deprecated and should go away. |
| 718 DumpDeprecatedHistograms(frame->performance(), document_state, | 770 DumpDeprecatedHistograms(frame->performance(), document_state, |
| 719 data_reduction_proxy_was_used, | 771 data_reduction_proxy_was_used, |
| 720 came_from_websearch, | 772 came_from_websearch, |
| 721 websearch_chrome_joint_experiment_id, | 773 websearch_chrome_joint_experiment_id, |
| 722 is_preview, | 774 is_preview, |
| 723 scheme_type); | 775 scheme_type); |
| 724 | 776 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 | 809 |
| 758 DCHECK(document_state); | 810 DCHECK(document_state); |
| 759 DCHECK(ds); | 811 DCHECK(ds); |
| 760 GURL url(ds->request().url()); | 812 GURL url(ds->request().url()); |
| 761 Time start = document_state->start_load_time(); | 813 Time start = document_state->start_load_time(); |
| 762 Time finish = document_state->finish_load_time(); | 814 Time finish = document_state->finish_load_time(); |
| 763 // TODO(mbelshe): should we log more stats? | 815 // TODO(mbelshe): should we log more stats? |
| 764 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 816 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 765 << url.spec(); | 817 << url.spec(); |
| 766 } | 818 } |
| OLD | NEW |