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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/renderer/chrome_content_renderer_client.h" | 21 #include "chrome/renderer/chrome_content_renderer_client.h" |
22 #include "chrome/renderer/searchbox/search_bouncer.h" | 22 #include "chrome/renderer/searchbox/search_bouncer.h" |
23 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me
ssages.h" | 23 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me
ssages.h" |
| 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
24 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
25 #include "content/public/renderer/document_state.h" | 26 #include "content/public/renderer/document_state.h" |
26 #include "content/public/renderer/render_thread.h" | 27 #include "content/public/renderer/render_thread.h" |
27 #include "content/public/renderer/render_view.h" | 28 #include "content/public/renderer/render_view.h" |
28 #include "extensions/common/url_pattern.h" | 29 #include "extensions/common/url_pattern.h" |
29 #include "net/base/url_util.h" | 30 #include "net/base/url_util.h" |
30 #include "net/http/http_response_headers.h" | 31 #include "net/http/http_response_headers.h" |
31 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 32 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
32 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 33 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
33 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
34 #include "third_party/WebKit/public/web/WebFrame.h" | 35 #include "third_party/WebKit/public/web/WebFrame.h" |
35 #include "third_party/WebKit/public/web/WebPerformance.h" | 36 #include "third_party/WebKit/public/web/WebPerformance.h" |
36 #include "third_party/WebKit/public/web/WebView.h" | 37 #include "third_party/WebKit/public/web/WebView.h" |
37 #include "url/gurl.h" | 38 #include "url/gurl.h" |
38 | 39 |
39 using blink::WebDataSource; | 40 using blink::WebDataSource; |
40 using blink::WebFrame; | 41 using blink::WebFrame; |
41 using blink::WebPerformance; | 42 using blink::WebPerformance; |
42 using blink::WebString; | 43 using blink::WebString; |
43 using base::Time; | 44 using base::Time; |
44 using base::TimeDelta; | 45 using base::TimeDelta; |
45 using content::DocumentState; | 46 using content::DocumentState; |
46 | 47 |
47 const size_t kPLTCount = 100; | 48 const size_t kPLTCount = 100; |
48 | 49 |
49 namespace { | 50 namespace { |
50 | 51 |
| 52 const char kEnabled[] = "Enabled"; |
| 53 const char kControl[] = "Control"; |
| 54 |
51 // ID indicating that no GWS-Chrome joint experiment is active. | 55 // ID indicating that no GWS-Chrome joint experiment is active. |
52 const int kNoExperiment = 0; | 56 const int kNoExperiment = 0; |
53 | 57 |
54 // Max ID of GWS-Chrome joint experiment. If you change this value, please | 58 // Max ID of GWS-Chrome joint experiment. If you change this value, please |
55 // update PLT_HISTOGRAM_WITH_GWS_VARIANT accordingly. | 59 // update PLT_HISTOGRAM_WITH_GWS_VARIANT accordingly. |
56 const int kMaxExperimentID = 20; | 60 const int kMaxExperimentID = 20; |
57 | 61 |
58 TimeDelta kPLTMin() { | 62 TimeDelta kPLTMin() { |
59 return TimeDelta::FromMilliseconds(10); | 63 return TimeDelta::FromMilliseconds(10); |
60 } | 64 } |
61 TimeDelta kPLTMax() { | 65 TimeDelta kPLTMax() { |
62 return TimeDelta::FromMinutes(10); | 66 return TimeDelta::FromMinutes(10); |
63 } | 67 } |
64 | 68 |
| 69 bool IsInLoFiEnabledGroup() { |
| 70 return base::FieldTrialList::FindFullName( |
| 71 data_reduction_proxy::params::GetLoFiFieldTrialName()) == kEnabled; |
| 72 } |
| 73 |
| 74 bool IsInLoFiControlGroup() { |
| 75 return base::FieldTrialList::FindFullName( |
| 76 data_reduction_proxy::params::GetLoFiFieldTrialName()) == kControl; |
| 77 } |
| 78 |
65 // This function corresponds to PLT_HISTOGRAM macro invocation without caching. | 79 // This function corresponds to PLT_HISTOGRAM macro invocation without caching. |
66 // Use this for PLT histograms with dynamically generated names, which | 80 // Use this for PLT histograms with dynamically generated names, which |
67 // otherwise can't use the caching PLT_HISTOGRAM macro without code duplication. | 81 // otherwise can't use the caching PLT_HISTOGRAM macro without code duplication. |
68 void PltHistogramWithNoMacroCaching(const std::string& name, | 82 void PltHistogramWithNoMacroCaching(const std::string& name, |
69 const TimeDelta& sample) { | 83 const TimeDelta& sample) { |
70 // The parameters should exacly match the parameters in | 84 // The parameters should exacly match the parameters in |
71 // UMA_HISTOGRAM_CUSTOM_TIMES macro. | 85 // UMA_HISTOGRAM_CUSTOM_TIMES macro. |
72 base::HistogramBase* histogram_pointer = base::Histogram::FactoryTimeGet( | 86 base::HistogramBase* histogram_pointer = base::Histogram::FactoryTimeGet( |
73 name, kPLTMin(), kPLTMax(), kPLTCount, | 87 name, kPLTMin(), kPLTMax(), kPLTCount, |
74 base::HistogramBase::kUmaTargetedHistogramFlag); | 88 base::HistogramBase::kUmaTargetedHistogramFlag); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if (!base::StringToInt(value, &experiment_id)) | 226 if (!base::StringToInt(value, &experiment_id)) |
213 return kNoExperiment; | 227 return kNoExperiment; |
214 if (0 < experiment_id && experiment_id <= kMaxExperimentID) | 228 if (0 < experiment_id && experiment_id <= kMaxExperimentID) |
215 return experiment_id; | 229 return experiment_id; |
216 return kNoExperiment; | 230 return kNoExperiment; |
217 } | 231 } |
218 | 232 |
219 void DumpHistograms(const WebPerformance& performance, | 233 void DumpHistograms(const WebPerformance& performance, |
220 DocumentState* document_state, | 234 DocumentState* document_state, |
221 bool data_reduction_proxy_was_used, | 235 bool data_reduction_proxy_was_used, |
222 data_reduction_proxy::LoFiStatus lofi_status, | 236 bool lofi_on, |
223 bool came_from_websearch, | 237 bool came_from_websearch, |
224 int websearch_chrome_joint_experiment_id, | 238 int websearch_chrome_joint_experiment_id, |
225 bool is_preview, | 239 bool is_preview, |
226 URLPattern::SchemeMasks scheme_type) { | 240 URLPattern::SchemeMasks scheme_type) { |
227 // This function records new histograms based on the Navigation Timing | 241 // This function records new histograms based on the Navigation Timing |
228 // records. As such, the histograms should not depend on the deprecated timing | 242 // records. As such, the histograms should not depend on the deprecated timing |
229 // information collected in DocumentState. However, here for some reason we | 243 // information collected in DocumentState. However, here for some reason we |
230 // check if document_state->request_time() is null. TODO(ppi): find out why | 244 // check if document_state->request_time() is null. TODO(ppi): find out why |
231 // and remove DocumentState from the parameter list. | 245 // and remove DocumentState from the parameter list. |
232 Time request = document_state->request_time(); | 246 Time request = document_state->request_time(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 load_event_end - navigation_start, | 418 load_event_end - navigation_start, |
405 came_from_websearch, | 419 came_from_websearch, |
406 websearch_chrome_joint_experiment_id, | 420 websearch_chrome_joint_experiment_id, |
407 is_preview); | 421 is_preview); |
408 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", | 422 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", |
409 load_event_end - request_start, | 423 load_event_end - request_start, |
410 came_from_websearch, | 424 came_from_websearch, |
411 websearch_chrome_joint_experiment_id, | 425 websearch_chrome_joint_experiment_id, |
412 is_preview); | 426 is_preview); |
413 if (data_reduction_proxy_was_used) { | 427 if (data_reduction_proxy_was_used) { |
| 428 bool in_lofi_enabled_group = IsInLoFiEnabledGroup(); |
| 429 bool in_lofi_control_group = IsInLoFiControlGroup(); |
414 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 430 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
415 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", | 431 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", |
416 load_event_end - begin); | 432 load_event_end - begin); |
417 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", | 433 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", |
418 load_event_end - response_start); | 434 load_event_end - response_start); |
419 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", | 435 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", |
420 load_event_end - navigation_start); | 436 load_event_end - navigation_start); |
421 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", | 437 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", |
422 load_event_end - request_start); | 438 load_event_end - request_start); |
423 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 439 if (lofi_on && in_lofi_enabled_group) { |
424 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn", | 440 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn", |
425 load_event_end - begin); | 441 load_event_end - begin); |
426 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn", | 442 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn", |
427 load_event_end - response_start); | 443 load_event_end - response_start); |
428 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn", | 444 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn", |
429 load_event_end - navigation_start); | 445 load_event_end - navigation_start); |
430 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn", | 446 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn", |
431 load_event_end - request_start); | 447 load_event_end - request_start); |
432 if (!first_paint.is_null()) { | 448 if (!first_paint.is_null()) { |
433 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn", | 449 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn", |
434 first_paint - begin); | 450 first_paint - begin); |
435 } | 451 } |
436 } else if (lofi_status == | 452 } else if (lofi_on && in_lofi_control_group) { |
437 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
438 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff", | 453 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff", |
439 load_event_end - begin); | 454 load_event_end - begin); |
440 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff", | 455 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff", |
441 load_event_end - response_start); | 456 load_event_end - response_start); |
442 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff", | 457 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff", |
443 load_event_end - navigation_start); | 458 load_event_end - navigation_start); |
444 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff", | 459 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff", |
445 load_event_end - request_start); | 460 load_event_end - request_start); |
446 if (!first_paint.is_null()) { | 461 if (!first_paint.is_null()) { |
447 PLT_HISTOGRAM( | 462 PLT_HISTOGRAM( |
448 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff", | 463 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff", |
449 first_paint - begin); | 464 first_paint - begin); |
450 } | 465 } |
451 } | 466 } |
452 } else { | 467 } else { |
453 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", | 468 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", |
454 load_event_end - begin); | 469 load_event_end - begin); |
455 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", | 470 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", |
456 load_event_end - response_start); | 471 load_event_end - response_start); |
457 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", | 472 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", |
458 load_event_end - navigation_start); | 473 load_event_end - navigation_start); |
459 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", | 474 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", |
460 load_event_end - request_start); | 475 load_event_end - request_start); |
461 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 476 if (lofi_on && in_lofi_enabled_group) { |
462 PLT_HISTOGRAM( | 477 PLT_HISTOGRAM( |
463 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 478 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
464 load_event_end - begin); | 479 load_event_end - begin); |
465 PLT_HISTOGRAM( | 480 PLT_HISTOGRAM( |
466 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 481 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
467 load_event_end - response_start); | 482 load_event_end - response_start); |
468 PLT_HISTOGRAM( | 483 PLT_HISTOGRAM( |
469 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 484 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
470 load_event_end - navigation_start); | 485 load_event_end - navigation_start); |
471 PLT_HISTOGRAM( | 486 PLT_HISTOGRAM( |
472 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 487 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
473 load_event_end - request_start); | 488 load_event_end - request_start); |
474 if (!first_paint.is_null()) { | 489 if (!first_paint.is_null()) { |
475 PLT_HISTOGRAM( | 490 PLT_HISTOGRAM( |
476 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn", | 491 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn", |
477 first_paint - begin); | 492 first_paint - begin); |
478 } | 493 } |
479 } else if (lofi_status == | 494 } else if (lofi_on && in_lofi_control_group) { |
480 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
481 PLT_HISTOGRAM( | 495 PLT_HISTOGRAM( |
482 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 496 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
483 load_event_end - begin); | 497 load_event_end - begin); |
484 PLT_HISTOGRAM( | 498 PLT_HISTOGRAM( |
485 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 499 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
486 load_event_end - response_start); | 500 load_event_end - response_start); |
487 PLT_HISTOGRAM( | 501 PLT_HISTOGRAM( |
488 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 502 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
489 load_event_end - navigation_start); | 503 load_event_end - navigation_start); |
490 PLT_HISTOGRAM( | 504 PLT_HISTOGRAM( |
(...skipping 26 matching lines...) Expand all Loading... |
517 } | 531 } |
518 } | 532 } |
519 } | 533 } |
520 if (!dom_content_loaded_start.is_null()) { | 534 if (!dom_content_loaded_start.is_null()) { |
521 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", | 535 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", |
522 dom_content_loaded_start - navigation_start, | 536 dom_content_loaded_start - navigation_start, |
523 came_from_websearch, | 537 came_from_websearch, |
524 websearch_chrome_joint_experiment_id, | 538 websearch_chrome_joint_experiment_id, |
525 is_preview); | 539 is_preview); |
526 if (data_reduction_proxy_was_used) { | 540 if (data_reduction_proxy_was_used) { |
| 541 bool in_lofi_enabled_group = IsInLoFiEnabledGroup(); |
| 542 bool in_lofi_control_group = IsInLoFiControlGroup(); |
527 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 543 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
528 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", | 544 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", |
529 dom_content_loaded_start - navigation_start); | 545 dom_content_loaded_start - navigation_start); |
530 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 546 if (lofi_on && in_lofi_enabled_group) { |
531 PLT_HISTOGRAM( | 547 PLT_HISTOGRAM( |
532 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn", | 548 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn", |
533 dom_content_loaded_start - navigation_start); | 549 dom_content_loaded_start - navigation_start); |
534 } else if (lofi_status == | 550 } else if (lofi_on && in_lofi_control_group) { |
535 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
536 PLT_HISTOGRAM( | 551 PLT_HISTOGRAM( |
537 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff", | 552 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff", |
538 dom_content_loaded_start - navigation_start); | 553 dom_content_loaded_start - navigation_start); |
539 } | 554 } |
540 } else { | 555 } else { |
541 PLT_HISTOGRAM( | 556 PLT_HISTOGRAM( |
542 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", | 557 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", |
543 dom_content_loaded_start - navigation_start); | 558 dom_content_loaded_start - navigation_start); |
544 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 559 if (lofi_on && in_lofi_enabled_group) { |
545 PLT_HISTOGRAM( | 560 PLT_HISTOGRAM( |
546 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | 561 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
547 "AutoLoFiOn", | 562 "AutoLoFiOn", |
548 dom_content_loaded_start - navigation_start); | 563 dom_content_loaded_start - navigation_start); |
549 } else if (lofi_status == | 564 } else if (lofi_on && in_lofi_control_group) { |
550 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
551 PLT_HISTOGRAM( | 565 PLT_HISTOGRAM( |
552 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | 566 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
553 "AutoLoFiOff", | 567 "AutoLoFiOff", |
554 dom_content_loaded_start - navigation_start); | 568 dom_content_loaded_start - navigation_start); |
555 } | 569 } |
556 } | 570 } |
557 } | 571 } |
558 } | 572 } |
559 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", | 573 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", |
560 response_start - begin, | 574 response_start - begin, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 return false; | 874 return false; |
861 } | 875 } |
862 | 876 |
863 // Ignore multipart requests. | 877 // Ignore multipart requests. |
864 if (frame->dataSource()->response().isMultipartPayload()) | 878 if (frame->dataSource()->response().isMultipartPayload()) |
865 return false; | 879 return false; |
866 | 880 |
867 return true; | 881 return true; |
868 } | 882 } |
869 | 883 |
870 void PageLoadHistograms::Dump(WebFrame* frame) { | 884 void PageLoadHistograms::Dump(WebFrame* frame, bool lofi_used) { |
871 if (!ShouldDump(frame)) | 885 if (!ShouldDump(frame)) |
872 return; | 886 return; |
873 | 887 |
874 URLPattern::SchemeMasks scheme_type = | 888 URLPattern::SchemeMasks scheme_type = |
875 GetSupportedSchemeType(frame->document().url()); | 889 GetSupportedSchemeType(frame->document().url()); |
876 | 890 |
877 DocumentState* document_state = | 891 DocumentState* document_state = |
878 DocumentState::FromDataSource(frame->dataSource()); | 892 DocumentState::FromDataSource(frame->dataSource()); |
879 | 893 |
880 bool data_reduction_proxy_was_used = false; | 894 bool data_reduction_proxy_was_used = false; |
881 data_reduction_proxy::LoFiStatus lofi_status = | |
882 data_reduction_proxy::LOFI_STATUS_TEMPORARILY_OFF; | |
883 if (!document_state->proxy_server().IsEmpty()) { | 895 if (!document_state->proxy_server().IsEmpty()) { |
884 Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus( | 896 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( |
885 document_state->proxy_server(), &data_reduction_proxy_was_used, | 897 document_state->proxy_server(), &data_reduction_proxy_was_used)); |
886 &lofi_status)); | |
887 } | 898 } |
888 | 899 |
889 bool came_from_websearch = | 900 bool came_from_websearch = |
890 IsFromGoogleSearchResult(frame->document().url(), | 901 IsFromGoogleSearchResult(frame->document().url(), |
891 GURL(frame->document().referrer())); | 902 GURL(frame->document().referrer())); |
892 int websearch_chrome_joint_experiment_id = kNoExperiment; | 903 int websearch_chrome_joint_experiment_id = kNoExperiment; |
893 bool is_preview = false; | 904 bool is_preview = false; |
894 if (came_from_websearch) { | 905 if (came_from_websearch) { |
895 websearch_chrome_joint_experiment_id = | 906 websearch_chrome_joint_experiment_id = |
896 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); | 907 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); |
897 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 908 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
898 } | 909 } |
899 | 910 |
900 MaybeDumpFirstLayoutHistograms(); | 911 MaybeDumpFirstLayoutHistograms(); |
901 | 912 |
902 // Metrics based on the timing information recorded for the Navigation Timing | 913 // Metrics based on the timing information recorded for the Navigation Timing |
903 // API - http://www.w3.org/TR/navigation-timing/. | 914 // API - http://www.w3.org/TR/navigation-timing/. |
904 DumpHistograms(frame->performance(), document_state, | 915 DumpHistograms(frame->performance(), document_state, |
905 data_reduction_proxy_was_used, lofi_status, | 916 data_reduction_proxy_was_used, lofi_used, came_from_websearch, |
906 came_from_websearch, websearch_chrome_joint_experiment_id, | 917 websearch_chrome_joint_experiment_id, is_preview, scheme_type); |
907 is_preview, scheme_type); | |
908 | 918 |
909 // Old metrics based on the timing information stored in DocumentState. These | 919 // Old metrics based on the timing information stored in DocumentState. These |
910 // are deprecated and should go away. | 920 // are deprecated and should go away. |
911 DumpDeprecatedHistograms(frame->performance(), document_state, | 921 DumpDeprecatedHistograms(frame->performance(), document_state, |
912 data_reduction_proxy_was_used, | 922 data_reduction_proxy_was_used, |
913 came_from_websearch, | 923 came_from_websearch, |
914 websearch_chrome_joint_experiment_id, | 924 websearch_chrome_joint_experiment_id, |
915 is_preview, | 925 is_preview, |
916 scheme_type); | 926 scheme_type); |
917 | 927 |
(...skipping 28 matching lines...) Expand all Loading... |
946 first_layout - navigation_start); | 956 first_layout - navigation_start); |
947 | 957 |
948 Time response_start = Time::FromDoubleT(performance.responseStart()); | 958 Time response_start = Time::FromDoubleT(performance.responseStart()); |
949 if (!response_start.is_null()) | 959 if (!response_start.is_null()) |
950 PLT_HISTOGRAM("PLT.PT.ResponseStartToFirstLayout", | 960 PLT_HISTOGRAM("PLT.PT.ResponseStartToFirstLayout", |
951 first_layout - response_start); | 961 first_layout - response_start); |
952 | 962 |
953 dumped_first_layout_histograms_ = true; | 963 dumped_first_layout_histograms_ = true; |
954 } | 964 } |
955 | 965 |
956 void PageLoadHistograms::FrameWillClose(WebFrame* frame) { | 966 void PageLoadHistograms::FrameWillClose(WebFrame* frame, bool lofi_used) { |
957 Dump(frame); | 967 Dump(frame, lofi_used); |
958 } | 968 } |
959 | 969 |
960 void PageLoadHistograms::ClosePage() { | 970 void PageLoadHistograms::ClosePage(bool lofi_used) { |
961 // TODO(davemoore) This code should be removed once willClose() gets | 971 // TODO(davemoore) This code should be removed once willClose() gets |
962 // called when a page is destroyed. page_load_histograms_.Dump() is safe | 972 // called when a page is destroyed. page_load_histograms_.Dump() is safe |
963 // to call multiple times for the same frame, but it will simplify things. | 973 // to call multiple times for the same frame, but it will simplify things. |
964 Dump(render_view()->GetWebView()->mainFrame()); | 974 Dump(render_view()->GetWebView()->mainFrame(), lofi_used); |
965 } | 975 } |
966 | 976 |
967 void PageLoadHistograms::DidUpdateLayout() { | 977 void PageLoadHistograms::DidUpdateLayout() { |
968 DCHECK(content::RenderThread::Get()); | 978 DCHECK(content::RenderThread::Get()); |
969 // Normally, PageLoadHistograms dumps all histograms in the FrameWillClose or | 979 // Normally, PageLoadHistograms dumps all histograms in the FrameWillClose or |
970 // ClosePage callbacks, which happen as a page is being torn down. However, | 980 // ClosePage callbacks, which happen as a page is being torn down. However, |
971 // renderers that are killed by fast shutdown (for example, renderers closed | 981 // renderers that are killed by fast shutdown (for example, renderers closed |
972 // due to the user closing a tab) don't get a chance to run these callbacks | 982 // due to the user closing a tab) don't get a chance to run these callbacks |
973 // (see crbug.com/382542 for details). | 983 // (see crbug.com/382542 for details). |
974 // | 984 // |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 | 1026 |
1017 DCHECK(document_state); | 1027 DCHECK(document_state); |
1018 DCHECK(ds); | 1028 DCHECK(ds); |
1019 GURL url(ds->request().url()); | 1029 GURL url(ds->request().url()); |
1020 Time start = document_state->start_load_time(); | 1030 Time start = document_state->start_load_time(); |
1021 Time finish = document_state->finish_load_time(); | 1031 Time finish = document_state->finish_load_time(); |
1022 // TODO(mbelshe): should we log more stats? | 1032 // TODO(mbelshe): should we log more stats? |
1023 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1033 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
1024 << url.spec(); | 1034 << url.spec(); |
1025 } | 1035 } |
OLD | NEW |