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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/metrics/persistent_histogram_allocator.h" | 16 #include "base/metrics/persistent_histogram_allocator.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/renderer/searchbox/search_bouncer.h" | 24 #include "chrome/renderer/searchbox/search_bouncer.h" |
| 25 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h" | |
| 26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | |
| 27 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
| 28 #include "content/public/renderer/document_state.h" | 26 #include "content/public/renderer/document_state.h" |
| 29 #include "content/public/renderer/render_frame.h" | 27 #include "content/public/renderer/render_frame.h" |
| 30 #include "content/public/renderer/render_thread.h" | 28 #include "content/public/renderer/render_thread.h" |
| 31 #include "content/public/renderer/render_view.h" | 29 #include "content/public/renderer/render_view.h" |
| 32 #include "extensions/common/url_pattern.h" | 30 #include "extensions/common/url_pattern.h" |
| 33 #include "net/base/url_util.h" | 31 #include "net/base/url_util.h" |
| 34 #include "net/http/http_response_headers.h" | 32 #include "net/http/http_response_headers.h" |
| 35 #include "third_party/WebKit/public/platform/URLConversion.h" | 33 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 36 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 34 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 std::string name_with_experiment_id = base::StringPrintf( \ | 111 std::string name_with_experiment_id = base::StringPrintf( \ |
| 114 "%s_FromGWS_Experiment%d", \ | 112 "%s_FromGWS_Experiment%d", \ |
| 115 name, websearch_chrome_joint_experiment_id); \ | 113 name, websearch_chrome_joint_experiment_id); \ |
| 116 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \ | 114 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \ |
| 117 } \ | 115 } \ |
| 118 } \ | 116 } \ |
| 119 PltHistogramWithGwsPreview(name, sample, is_preview, \ | 117 PltHistogramWithGwsPreview(name, sample, is_preview, \ |
| 120 websearch_chrome_joint_experiment_id); \ | 118 websearch_chrome_joint_experiment_id); \ |
| 121 } | 119 } |
| 122 | 120 |
| 123 // In addition to PLT_HISTOGRAM, add the *_DataReductionProxy variant | |
| 124 // conditionally. This macro runs only in one thread. | |
| 125 #define PLT_HISTOGRAM_DRP( \ | |
| 126 name, sample, data_reduction_proxy_was_used, scheme_type) \ | |
| 127 do { \ | |
| 128 static base::HistogramBase* counter(NULL); \ | |
| 129 static base::HistogramBase* drp_counter(NULL); \ | |
| 130 static base::HistogramBase* https_drp_counter(NULL); \ | |
| 131 if (!counter) { \ | |
| 132 DCHECK(drp_counter == NULL); \ | |
| 133 DCHECK(https_drp_counter == NULL); \ | |
| 134 counter = base::Histogram::FactoryTimeGet( \ | |
| 135 name, kPLTMin(), kPLTMax(), kPLTCount, \ | |
| 136 base::Histogram::kUmaTargetedHistogramFlag); \ | |
| 137 } \ | |
| 138 counter->AddTime(sample); \ | |
| 139 if (!data_reduction_proxy_was_used) break; \ | |
| 140 if (scheme_type & URLPattern::SCHEME_HTTPS) { \ | |
| 141 if (!https_drp_counter) { \ | |
| 142 https_drp_counter = base::Histogram::FactoryTimeGet( \ | |
| 143 std::string(name) + "_HTTPS_DataReductionProxy", \ | |
| 144 kPLTMin(), kPLTMax(), kPLTCount, \ | |
| 145 base::Histogram::kUmaTargetedHistogramFlag); \ | |
| 146 } \ | |
| 147 https_drp_counter->AddTime(sample); \ | |
| 148 } else { \ | |
| 149 if (!drp_counter) { \ | |
| 150 drp_counter = base::Histogram::FactoryTimeGet( \ | |
| 151 std::string(name) + "_DataReductionProxy", \ | |
| 152 kPLTMin(), kPLTMax(), kPLTCount, \ | |
| 153 base::Histogram::kUmaTargetedHistogramFlag); \ | |
| 154 } \ | |
| 155 drp_counter->AddTime(sample); \ | |
| 156 } \ | |
| 157 } while (0) | |
| 158 | |
| 159 // Returns the scheme type of the given URL if its type is one for which we | 121 // Returns the scheme type of the given URL if its type is one for which we |
| 160 // dump page load histograms. Otherwise returns NULL. | 122 // dump page load histograms. Otherwise returns NULL. |
| 161 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { | 123 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { |
| 162 if (url.SchemeIs("http")) | 124 if (url.SchemeIs("http")) |
| 163 return URLPattern::SCHEME_HTTP; | 125 return URLPattern::SCHEME_HTTP; |
| 164 else if (url.SchemeIs("https")) | 126 else if (url.SchemeIs("https")) |
| 165 return URLPattern::SCHEME_HTTPS; | 127 return URLPattern::SCHEME_HTTPS; |
| 166 return static_cast<URLPattern::SchemeMasks>(0); | 128 return static_cast<URLPattern::SchemeMasks>(0); |
| 167 } | 129 } |
| 168 | 130 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 int experiment_id; | 183 int experiment_id; |
| 222 if (!base::StringToInt(value, &experiment_id)) | 184 if (!base::StringToInt(value, &experiment_id)) |
| 223 return kNoExperiment; | 185 return kNoExperiment; |
| 224 if (0 < experiment_id && experiment_id <= kMaxExperimentID) | 186 if (0 < experiment_id && experiment_id <= kMaxExperimentID) |
| 225 return experiment_id; | 187 return experiment_id; |
| 226 return kNoExperiment; | 188 return kNoExperiment; |
| 227 } | 189 } |
| 228 | 190 |
| 229 void DumpHistograms(const WebPerformance& performance, | 191 void DumpHistograms(const WebPerformance& performance, |
| 230 DocumentState* document_state, | 192 DocumentState* document_state, |
| 231 bool data_reduction_proxy_was_used, | |
| 232 bool lofi_active_for_page, // LoFi was used, unless part of | 193 bool lofi_active_for_page, // LoFi was used, unless part of |
|
tbansal1
2016/09/07 16:50:55
Remove this too?
RyanSturm
2016/09/07 18:14:44
Done.
| |
| 233 // the control group. | 194 // the control group. |
| 234 bool came_from_websearch, | 195 bool came_from_websearch, |
| 235 int websearch_chrome_joint_experiment_id, | 196 int websearch_chrome_joint_experiment_id, |
| 236 bool is_preview, | 197 bool is_preview, |
| 237 URLPattern::SchemeMasks scheme_type) { | 198 URLPattern::SchemeMasks scheme_type) { |
| 238 // This function records new histograms based on the Navigation Timing | 199 // This function records new histograms based on the Navigation Timing |
| 239 // records. As such, the histograms should not depend on the deprecated timing | 200 // records. As such, the histograms should not depend on the deprecated timing |
| 240 // information collected in DocumentState. However, here for some reason we | 201 // information collected in DocumentState. However, here for some reason we |
| 241 // check if document_state->request_time() is null. TODO(ppi): find out why | 202 // check if document_state->request_time() is null. TODO(ppi): find out why |
| 242 // and remove DocumentState from the parameter list. | 203 // and remove DocumentState from the parameter list. |
| 243 Time request = document_state->request_time(); | 204 Time request = document_state->request_time(); |
| 244 | 205 |
| 245 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); | 206 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); |
| 246 Time domain_lookup_start = Time::FromDoubleT(performance.domainLookupStart()); | |
| 247 Time domain_lookup_end = Time::FromDoubleT(performance.domainLookupEnd()); | |
| 248 Time connect_start = Time::FromDoubleT(performance.connectStart()); | |
| 249 Time connect_end = Time::FromDoubleT(performance.connectEnd()); | |
| 250 Time request_start = Time::FromDoubleT(performance.requestStart()); | 207 Time request_start = Time::FromDoubleT(performance.requestStart()); |
| 251 Time response_start = Time::FromDoubleT(performance.responseStart()); | 208 Time response_start = Time::FromDoubleT(performance.responseStart()); |
| 252 Time dom_loading = Time::FromDoubleT(performance.domLoading()); | |
| 253 Time dom_interactive = Time::FromDoubleT(performance.domInteractive()); | |
| 254 Time dom_content_loaded_start = | 209 Time dom_content_loaded_start = |
| 255 Time::FromDoubleT(performance.domContentLoadedEventStart()); | 210 Time::FromDoubleT(performance.domContentLoadedEventStart()); |
| 256 Time dom_content_loaded_end = | |
| 257 Time::FromDoubleT(performance.domContentLoadedEventEnd()); | |
| 258 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); | 211 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); |
| 259 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); | 212 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); |
| 260 Time begin = (request.is_null() ? navigation_start : request_start); | 213 Time begin = (request.is_null() ? navigation_start : request_start); |
| 261 Time first_paint = document_state->first_paint_time(); | |
| 262 | 214 |
| 263 DCHECK(!navigation_start.is_null()); | 215 DCHECK(!navigation_start.is_null()); |
| 264 | 216 |
| 265 // It is possible for a document to have navigation_start time, but no | 217 // It is possible for a document to have navigation_start time, but no |
| 266 // request_start. An example is doing a window.open, which synchronously | 218 // request_start. An example is doing a window.open, which synchronously |
| 267 // loads "about:blank", then using document.write add a meta http-equiv | 219 // loads "about:blank", then using document.write add a meta http-equiv |
| 268 // refresh tag, which causes a navigation. In such case, we will arrive at | 220 // refresh tag, which causes a navigation. In such case, we will arrive at |
| 269 // this function with no request/response timing data and identical load | 221 // this function with no request/response timing data and identical load |
| 270 // start/end values. Avoid logging this case, as it doesn't add any | 222 // start/end values. Avoid logging this case, as it doesn't add any |
| 271 // meaningful information to the histogram. | 223 // meaningful information to the histogram. |
| 272 if (request_start.is_null()) | 224 if (request_start.is_null()) |
| 273 return; | 225 return; |
| 274 | 226 |
| 275 // TODO(dominich): Investigate conditions under which |load_event_start| and | 227 // TODO(dominich): Investigate conditions under which |load_event_start| and |
| 276 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in | 228 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in |
| 277 // http://crbug.com/112006. | 229 // http://crbug.com/112006. |
| 278 // DCHECK(!load_event_start.is_null()); | 230 // DCHECK(!load_event_start.is_null()); |
| 279 // DCHECK(!load_event_end.is_null()); | 231 // DCHECK(!load_event_end.is_null()); |
| 280 | 232 |
| 281 if (document_state->web_timing_histograms_recorded()) | 233 if (document_state->web_timing_histograms_recorded()) |
| 282 return; | 234 return; |
| 283 document_state->set_web_timing_histograms_recorded(true); | 235 document_state->set_web_timing_histograms_recorded(true); |
| 284 | 236 |
| 285 PLT_HISTOGRAM_DRP("PLT.NT_DomainLookup", | |
| 286 domain_lookup_end - domain_lookup_start, | |
| 287 data_reduction_proxy_was_used, | |
| 288 scheme_type); | |
| 289 PLT_HISTOGRAM_DRP("PLT.NT_Connect", | |
| 290 connect_end - connect_start, | |
| 291 data_reduction_proxy_was_used, | |
| 292 scheme_type); | |
| 293 | |
| 294 if (!dom_interactive.is_null() && !dom_loading.is_null()) { | |
| 295 PLT_HISTOGRAM_DRP("PLT.NT_DomLoading", | |
| 296 dom_interactive - dom_loading, | |
| 297 data_reduction_proxy_was_used, | |
| 298 scheme_type); | |
| 299 } | |
| 300 if (!dom_content_loaded_start.is_null() && !dom_interactive.is_null()) { | |
| 301 PLT_HISTOGRAM_DRP("PLT.NT_DomInteractive", | |
| 302 dom_content_loaded_start - dom_interactive, | |
| 303 data_reduction_proxy_was_used, | |
| 304 scheme_type); | |
| 305 } | |
| 306 if (!dom_content_loaded_start.is_null() && | |
| 307 !dom_content_loaded_end.is_null() ) { | |
| 308 PLT_HISTOGRAM_DRP("PLT.NT_DomContentLoaded", | |
| 309 dom_content_loaded_end - dom_content_loaded_start, | |
| 310 data_reduction_proxy_was_used, | |
| 311 scheme_type); | |
| 312 } | |
| 313 | |
| 314 // TODO(simonjam): There is no way to distinguish between abandonment and | 237 // TODO(simonjam): There is no way to distinguish between abandonment and |
| 315 // intentional Javascript navigation before the load event fires. | 238 // intentional Javascript navigation before the load event fires. |
| 316 // TODO(dominich): Load type breakdown | 239 // TODO(dominich): Load type breakdown |
| 317 if (!load_event_start.is_null()) { | 240 if (!load_event_start.is_null()) { |
| 318 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc", | 241 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc", |
| 319 load_event_start - begin, | 242 load_event_start - begin, |
| 320 came_from_websearch, | 243 came_from_websearch, |
| 321 websearch_chrome_joint_experiment_id, | 244 websearch_chrome_joint_experiment_id, |
| 322 is_preview); | 245 is_preview); |
| 323 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc", | 246 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc", |
| 324 load_event_start - response_start, | 247 load_event_start - response_start, |
| 325 came_from_websearch, | 248 came_from_websearch, |
| 326 websearch_chrome_joint_experiment_id, | 249 websearch_chrome_joint_experiment_id, |
| 327 is_preview); | 250 is_preview); |
| 328 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc", | 251 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc", |
| 329 load_event_start - navigation_start, | 252 load_event_start - navigation_start, |
| 330 came_from_websearch, | 253 came_from_websearch, |
| 331 websearch_chrome_joint_experiment_id, | 254 websearch_chrome_joint_experiment_id, |
| 332 is_preview); | 255 is_preview); |
| 333 if (data_reduction_proxy_was_used) { | |
| 334 if (scheme_type & URLPattern::SCHEME_HTTPS) { | |
| 335 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_HTTPS_DataReductionProxy", | |
| 336 load_event_start - begin); | |
| 337 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_HTTPS_DataReductionProxy", | |
| 338 load_event_start - response_start); | |
| 339 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_HTTPS_DataReductionProxy", | |
| 340 load_event_start - navigation_start); | |
| 341 } else { | |
| 342 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_DataReductionProxy", | |
| 343 load_event_start - begin); | |
| 344 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_DataReductionProxy", | |
| 345 load_event_start - response_start); | |
| 346 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_DataReductionProxy", | |
| 347 load_event_start - navigation_start); | |
| 348 } | |
| 349 } | |
| 350 } | 256 } |
| 351 if (!load_event_end.is_null()) { | 257 if (!load_event_end.is_null()) { |
| 352 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish", | 258 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish", |
| 353 load_event_end - begin, | 259 load_event_end - begin, |
| 354 came_from_websearch, | 260 came_from_websearch, |
| 355 websearch_chrome_joint_experiment_id, | 261 websearch_chrome_joint_experiment_id, |
| 356 is_preview); | 262 is_preview); |
| 357 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish", | 263 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish", |
| 358 load_event_end - response_start, | 264 load_event_end - response_start, |
| 359 came_from_websearch, | 265 came_from_websearch, |
| 360 websearch_chrome_joint_experiment_id, | 266 websearch_chrome_joint_experiment_id, |
| 361 is_preview); | 267 is_preview); |
| 362 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish", | 268 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish", |
| 363 load_event_end - navigation_start, | 269 load_event_end - navigation_start, |
| 364 came_from_websearch, | 270 came_from_websearch, |
| 365 websearch_chrome_joint_experiment_id, | 271 websearch_chrome_joint_experiment_id, |
| 366 is_preview); | 272 is_preview); |
| 367 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", | 273 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", |
| 368 load_event_end - request_start, | 274 load_event_end - request_start, |
| 369 came_from_websearch, | 275 came_from_websearch, |
| 370 websearch_chrome_joint_experiment_id, | 276 websearch_chrome_joint_experiment_id, |
| 371 is_preview); | 277 is_preview); |
| 372 if (data_reduction_proxy_was_used) { | |
| 373 // TODO(megjablon): Move these repetitive cases into an anonymous | |
| 374 // function. | |
| 375 bool in_lofi_enabled_group = | |
| 376 data_reduction_proxy::params::IsIncludedInLoFiEnabledFieldTrial(); | |
| 377 bool in_lofi_control_group = | |
| 378 data_reduction_proxy::params::IsIncludedInLoFiControlFieldTrial(); | |
| 379 if (scheme_type & URLPattern::SCHEME_HTTPS) { | |
| 380 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", | |
| 381 load_event_end - begin); | |
| 382 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", | |
| 383 load_event_end - response_start); | |
| 384 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", | |
| 385 load_event_end - navigation_start); | |
| 386 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", | |
| 387 load_event_end - request_start); | |
| 388 if (lofi_active_for_page && in_lofi_enabled_group) { | |
| 389 PLT_HISTOGRAM( | |
| 390 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | |
| 391 load_event_end - begin); | |
| 392 PLT_HISTOGRAM( | |
| 393 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | |
| 394 load_event_end - response_start); | |
| 395 PLT_HISTOGRAM( | |
| 396 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | |
| 397 load_event_end - navigation_start); | |
| 398 PLT_HISTOGRAM( | |
| 399 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | |
| 400 load_event_end - request_start); | |
| 401 if (!first_paint.is_null()) { | |
| 402 PLT_HISTOGRAM( | |
| 403 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn", | |
| 404 first_paint - begin); | |
| 405 } | |
| 406 } else if (lofi_active_for_page && in_lofi_control_group) { | |
| 407 PLT_HISTOGRAM( | |
| 408 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | |
| 409 load_event_end - begin); | |
| 410 PLT_HISTOGRAM( | |
| 411 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | |
| 412 load_event_end - response_start); | |
| 413 PLT_HISTOGRAM( | |
| 414 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | |
| 415 load_event_end - navigation_start); | |
| 416 PLT_HISTOGRAM( | |
| 417 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | |
| 418 load_event_end - request_start); | |
| 419 if (!first_paint.is_null()) { | |
| 420 PLT_HISTOGRAM( | |
| 421 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOff", | |
| 422 first_paint - begin); | |
| 423 } | |
| 424 } | |
| 425 } else { | |
| 426 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", | |
| 427 load_event_end - begin); | |
| 428 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", | |
| 429 load_event_end - response_start); | |
| 430 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", | |
| 431 load_event_end - navigation_start); | |
| 432 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", | |
| 433 load_event_end - request_start); | |
| 434 if (lofi_active_for_page && in_lofi_enabled_group) { | |
| 435 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn", | |
| 436 load_event_end - begin); | |
| 437 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn", | |
| 438 load_event_end - response_start); | |
| 439 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn", | |
| 440 load_event_end - navigation_start); | |
| 441 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn", | |
| 442 load_event_end - request_start); | |
| 443 if (!first_paint.is_null()) { | |
| 444 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn", | |
| 445 first_paint - begin); | |
| 446 } | |
| 447 } else if (lofi_active_for_page && in_lofi_control_group) { | |
| 448 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff", | |
| 449 load_event_end - begin); | |
| 450 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff", | |
| 451 load_event_end - response_start); | |
| 452 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff", | |
| 453 load_event_end - navigation_start); | |
| 454 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff", | |
| 455 load_event_end - request_start); | |
| 456 if (!first_paint.is_null()) { | |
| 457 PLT_HISTOGRAM( | |
| 458 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff", | |
| 459 first_paint - begin); | |
| 460 } | |
| 461 } | |
| 462 } | |
| 463 } | |
| 464 } | 278 } |
| 465 if (!load_event_start.is_null() && !load_event_end.is_null()) { | 279 if (!load_event_start.is_null() && !load_event_end.is_null()) { |
| 466 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", | 280 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", |
| 467 load_event_end - load_event_start); | 281 load_event_end - load_event_start); |
| 468 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", | |
| 469 load_event_end - load_event_start, | |
| 470 data_reduction_proxy_was_used, | |
| 471 scheme_type); | |
| 472 | |
| 473 if (data_reduction_proxy_was_used) { | |
| 474 if (scheme_type & URLPattern::SCHEME_HTTPS) { | |
| 475 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_HTTPS_DataReductionProxy", | |
| 476 load_event_end - load_event_start); | |
| 477 } else { | |
| 478 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_DataReductionProxy", | |
| 479 load_event_end - load_event_start); | |
| 480 } | |
| 481 } | |
| 482 } | 282 } |
| 483 if (!dom_content_loaded_start.is_null()) { | 283 if (!dom_content_loaded_start.is_null()) { |
| 484 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", | 284 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", |
| 485 dom_content_loaded_start - navigation_start, | 285 dom_content_loaded_start - navigation_start, |
| 486 came_from_websearch, | 286 came_from_websearch, |
| 487 websearch_chrome_joint_experiment_id, | 287 websearch_chrome_joint_experiment_id, |
| 488 is_preview); | 288 is_preview); |
| 489 if (data_reduction_proxy_was_used) { | |
| 490 bool in_lofi_enabled_group = | |
| 491 data_reduction_proxy::params::IsIncludedInLoFiEnabledFieldTrial(); | |
| 492 bool in_lofi_control_group = | |
| 493 data_reduction_proxy::params::IsIncludedInLoFiControlFieldTrial(); | |
| 494 if (scheme_type & URLPattern::SCHEME_HTTPS) { | |
| 495 PLT_HISTOGRAM( | |
| 496 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", | |
| 497 dom_content_loaded_start - navigation_start); | |
| 498 if (lofi_active_for_page && in_lofi_enabled_group) { | |
| 499 PLT_HISTOGRAM( | |
| 500 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | |
| 501 "AutoLoFiOn", | |
| 502 dom_content_loaded_start - navigation_start); | |
| 503 } else if (lofi_active_for_page && in_lofi_control_group) { | |
| 504 PLT_HISTOGRAM( | |
| 505 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | |
| 506 "AutoLoFiOff", | |
| 507 dom_content_loaded_start - navigation_start); | |
| 508 } | |
| 509 } else { | |
| 510 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", | |
| 511 dom_content_loaded_start - navigation_start); | |
| 512 if (lofi_active_for_page && in_lofi_enabled_group) { | |
| 513 PLT_HISTOGRAM( | |
| 514 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn", | |
| 515 dom_content_loaded_start - navigation_start); | |
| 516 } else if (lofi_active_for_page && in_lofi_control_group) { | |
| 517 PLT_HISTOGRAM( | |
| 518 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff", | |
| 519 dom_content_loaded_start - navigation_start); | |
| 520 } | |
| 521 } | |
| 522 } | |
| 523 } | 289 } |
| 524 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", | 290 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", |
| 525 response_start - begin, | 291 response_start - begin, |
| 526 came_from_websearch, | 292 came_from_websearch, |
| 527 websearch_chrome_joint_experiment_id, | 293 websearch_chrome_joint_experiment_id, |
| 528 is_preview); | 294 is_preview); |
| 529 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", | 295 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", |
| 530 request_start - navigation_start, | 296 request_start - navigation_start, |
| 531 came_from_websearch, | 297 came_from_websearch, |
| 532 websearch_chrome_joint_experiment_id, | 298 websearch_chrome_joint_experiment_id, |
| 533 is_preview); | 299 is_preview); |
| 534 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit", | 300 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit", |
| 535 response_start - request_start, | 301 response_start - request_start, |
| 536 came_from_websearch, | 302 came_from_websearch, |
| 537 websearch_chrome_joint_experiment_id, | 303 websearch_chrome_joint_experiment_id, |
| 538 is_preview); | 304 is_preview); |
| 539 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit", | 305 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit", |
| 540 response_start - navigation_start, | 306 response_start - navigation_start, |
| 541 came_from_websearch, | 307 came_from_websearch, |
| 542 websearch_chrome_joint_experiment_id, | 308 websearch_chrome_joint_experiment_id, |
| 543 is_preview); | 309 is_preview); |
| 544 if (data_reduction_proxy_was_used) { | |
| 545 if (scheme_type & URLPattern::SCHEME_HTTPS) { | |
| 546 PLT_HISTOGRAM("PLT.PT_BeginToCommit_HTTPS_DataReductionProxy", | |
| 547 response_start - begin); | |
| 548 PLT_HISTOGRAM("PLT.PT_RequestToStart_HTTPS_DataReductionProxy", | |
| 549 request_start - navigation_start); | |
| 550 PLT_HISTOGRAM("PLT.PT_StartToCommit_HTTPS_DataReductionProxy", | |
| 551 response_start - request_start); | |
| 552 PLT_HISTOGRAM("PLT.PT_RequestToCommit_HTTPS_DataReductionProxy", | |
| 553 response_start - navigation_start); | |
| 554 } else { | |
| 555 PLT_HISTOGRAM("PLT.PT_BeginToCommit_DataReductionProxy", | |
| 556 response_start - begin); | |
| 557 PLT_HISTOGRAM("PLT.PT_RequestToStart_DataReductionProxy", | |
| 558 request_start - navigation_start); | |
| 559 PLT_HISTOGRAM("PLT.PT_StartToCommit_DataReductionProxy", | |
| 560 response_start - request_start); | |
| 561 PLT_HISTOGRAM("PLT.PT_RequestToCommit_DataReductionProxy", | |
| 562 response_start - navigation_start); | |
| 563 } | |
| 564 } | |
| 565 } | 310 } |
| 566 | 311 |
| 567 bool WasWebRequestUsedBySomeExtensions() { | 312 bool WasWebRequestUsedBySomeExtensions() { |
| 568 #if defined(ENABLE_EXTENSIONS) | 313 #if defined(ENABLE_EXTENSIONS) |
| 569 return ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher() | 314 return ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher() |
| 570 ->WasWebRequestUsedBySomeExtensions(); | 315 ->WasWebRequestUsedBySomeExtensions(); |
| 571 #else | 316 #else |
| 572 return false; | 317 return false; |
| 573 #endif | 318 #endif |
| 574 } | 319 } |
| 575 | 320 |
| 576 // These histograms are based on the timing information collected in | 321 // These histograms are based on the timing information collected in |
| 577 // DocumentState. They should be transitioned to equivalents based on the | 322 // DocumentState. They should be transitioned to equivalents based on the |
| 578 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not | 323 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not |
| 579 // needed. Please do not add new metrics based on DocumentState. | 324 // needed. Please do not add new metrics based on DocumentState. |
| 580 void DumpDeprecatedHistograms(const WebPerformance& performance, | 325 void DumpDeprecatedHistograms(const WebPerformance& performance, |
| 581 DocumentState* document_state, | 326 DocumentState* document_state, |
| 582 bool data_reduction_proxy_was_used, | |
| 583 bool came_from_websearch, | 327 bool came_from_websearch, |
| 584 int websearch_chrome_joint_experiment_id, | 328 int websearch_chrome_joint_experiment_id, |
| 585 bool is_preview, | 329 bool is_preview, |
| 586 URLPattern::SchemeMasks scheme_type) { | 330 URLPattern::SchemeMasks scheme_type) { |
| 587 // If we've already dumped, do nothing. | 331 // If we've already dumped, do nothing. |
| 588 // This simple bool works because we only dump for the main frame. | 332 // This simple bool works because we only dump for the main frame. |
| 589 if (document_state->load_histograms_recorded()) | 333 if (document_state->load_histograms_recorded()) |
| 590 return; | 334 return; |
| 591 | 335 |
| 592 // Abort if any of these is missing. | 336 // Abort if any of these is missing. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 case DocumentState::LINK_LOAD_CACHE_ONLY: | 489 case DocumentState::LINK_LOAD_CACHE_ONLY: |
| 746 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly", | 490 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly", |
| 747 begin_to_finish_doc); | 491 begin_to_finish_doc); |
| 748 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", | 492 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", |
| 749 begin_to_finish_all_loads); | 493 begin_to_finish_all_loads); |
| 750 break; | 494 break; |
| 751 default: | 495 default: |
| 752 break; | 496 break; |
| 753 } | 497 } |
| 754 | 498 |
| 755 if (data_reduction_proxy_was_used) { | |
| 756 PLT_HISTOGRAM("PLT.BeginToFinishDoc_SpdyProxy", begin_to_finish_doc); | |
| 757 PLT_HISTOGRAM("PLT.BeginToFinish_SpdyProxy", begin_to_finish_all_loads); | |
| 758 } | |
| 759 | |
| 760 if (document_state->was_prefetcher()) { | 499 if (document_state->was_prefetcher()) { |
| 761 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcher", | 500 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcher", |
| 762 begin_to_finish_doc); | 501 begin_to_finish_doc); |
| 763 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcher", | 502 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcher", |
| 764 begin_to_finish_all_loads); | 503 begin_to_finish_all_loads); |
| 765 } | 504 } |
| 766 if (document_state->was_referred_by_prefetcher()) { | 505 if (document_state->was_referred_by_prefetcher()) { |
| 767 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcherReferrer", | 506 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcherReferrer", |
| 768 begin_to_finish_doc); | 507 begin_to_finish_doc); |
| 769 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcherReferrer", | 508 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcherReferrer", |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 | 566 |
| 828 // Don't dump stats for the NTP, as PageLoadHistograms should only be recorded | 567 // Don't dump stats for the NTP, as PageLoadHistograms should only be recorded |
| 829 // for pages visited due to an explicit user navigation. | 568 // for pages visited due to an explicit user navigation. |
| 830 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) { | 569 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) { |
| 831 return; | 570 return; |
| 832 } | 571 } |
| 833 | 572 |
| 834 DocumentState* document_state = | 573 DocumentState* document_state = |
| 835 DocumentState::FromDataSource(frame->dataSource()); | 574 DocumentState::FromDataSource(frame->dataSource()); |
| 836 | 575 |
| 837 bool data_reduction_proxy_was_used = false; | |
| 838 if (!document_state->proxy_server().IsEmpty()) { | |
| 839 bool handled = | |
| 840 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( | |
| 841 document_state->proxy_server(), &data_reduction_proxy_was_used)); | |
| 842 // If the IPC call is not handled, then |data_reduction_proxy_was_used| | |
| 843 // should remain |false|. | |
| 844 DCHECK(handled || !data_reduction_proxy_was_used); | |
| 845 } | |
| 846 | |
| 847 bool came_from_websearch = IsFromGoogleSearchResult( | 576 bool came_from_websearch = IsFromGoogleSearchResult( |
| 848 frame->document().url(), | 577 frame->document().url(), |
| 849 blink::WebStringToGURL(frame->document().referrer())); | 578 blink::WebStringToGURL(frame->document().referrer())); |
| 850 int websearch_chrome_joint_experiment_id = kNoExperiment; | 579 int websearch_chrome_joint_experiment_id = kNoExperiment; |
| 851 bool is_preview = false; | 580 bool is_preview = false; |
| 852 if (came_from_websearch) { | 581 if (came_from_websearch) { |
| 853 websearch_chrome_joint_experiment_id = GetQueryStringBasedExperiment( | 582 websearch_chrome_joint_experiment_id = GetQueryStringBasedExperiment( |
| 854 blink::WebStringToGURL(frame->document().referrer())); | 583 blink::WebStringToGURL(frame->document().referrer())); |
| 855 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 584 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
| 856 } | 585 } |
| 857 | 586 |
| 858 content::RenderFrame* render_frame = | 587 content::RenderFrame* render_frame = |
| 859 content::RenderFrame::FromWebFrame(frame); | 588 content::RenderFrame::FromWebFrame(frame); |
| 860 | 589 |
| 861 // Metrics based on the timing information recorded for the Navigation Timing | 590 // Metrics based on the timing information recorded for the Navigation Timing |
| 862 // API - http://www.w3.org/TR/navigation-timing/. | 591 // API - http://www.w3.org/TR/navigation-timing/. |
| 863 DumpHistograms( | 592 DumpHistograms(frame->performance(), document_state, |
| 864 frame->performance(), document_state, data_reduction_proxy_was_used, | 593 render_frame && render_frame->IsUsingLoFi(), |
| 865 render_frame && render_frame->IsUsingLoFi(), came_from_websearch, | 594 came_from_websearch, websearch_chrome_joint_experiment_id, |
| 866 websearch_chrome_joint_experiment_id, is_preview, scheme_type); | 595 is_preview, scheme_type); |
| 867 | 596 |
| 868 // Old metrics based on the timing information stored in DocumentState. These | 597 // Old metrics based on the timing information stored in DocumentState. These |
| 869 // are deprecated and should go away. | 598 // are deprecated and should go away. |
| 870 DumpDeprecatedHistograms(frame->performance(), document_state, | 599 DumpDeprecatedHistograms(frame->performance(), document_state, |
| 871 data_reduction_proxy_was_used, | 600 |
| 872 came_from_websearch, | 601 came_from_websearch, |
| 873 websearch_chrome_joint_experiment_id, | 602 websearch_chrome_joint_experiment_id, is_preview, |
| 874 is_preview, | |
| 875 scheme_type); | 603 scheme_type); |
| 876 | 604 |
| 877 // Log the PLT to the info log. | 605 // Log the PLT to the info log. |
| 878 LogPageLoadTime(document_state, frame->dataSource()); | 606 LogPageLoadTime(document_state, frame->dataSource()); |
| 879 | 607 |
| 880 // If persistent histograms are not enabled, initiate a PostTask here to be | 608 // If persistent histograms are not enabled, initiate a PostTask here to be |
| 881 // sure that we send the histograms generated. Without this call, pages | 609 // sure that we send the histograms generated. Without this call, pages |
| 882 // that don't have an on-close-handler might generate data that is lost if | 610 // that don't have an on-close-handler might generate data that is lost if |
| 883 // the renderer is shutdown abruptly (e.g. the user closed the tab). | 611 // the renderer is shutdown abruptly (e.g. the user closed the tab). |
| 884 // TODO(bcwhite): Remove completely when persistence is on-by-default. | 612 // TODO(bcwhite): Remove completely when persistence is on-by-default. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 912 Time start = document_state->start_load_time(); | 640 Time start = document_state->start_load_time(); |
| 913 Time finish = document_state->finish_load_time(); | 641 Time finish = document_state->finish_load_time(); |
| 914 // TODO(mbelshe): should we log more stats? | 642 // TODO(mbelshe): should we log more stats? |
| 915 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 643 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 916 << url.spec(); | 644 << url.spec(); |
| 917 } | 645 } |
| 918 | 646 |
| 919 void PageLoadHistograms::OnDestruct() { | 647 void PageLoadHistograms::OnDestruct() { |
| 920 delete this; | 648 delete this; |
| 921 } | 649 } |
| OLD | NEW |