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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!base::StringToInt(value, &experiment_id)) | 206 if (!base::StringToInt(value, &experiment_id)) |
207 return kNoExperiment; | 207 return kNoExperiment; |
208 if (0 < experiment_id && experiment_id <= kMaxExperimentID) | 208 if (0 < experiment_id && experiment_id <= kMaxExperimentID) |
209 return experiment_id; | 209 return experiment_id; |
210 return kNoExperiment; | 210 return kNoExperiment; |
211 } | 211 } |
212 | 212 |
213 void DumpHistograms(const WebPerformance& performance, | 213 void DumpHistograms(const WebPerformance& performance, |
214 DocumentState* document_state, | 214 DocumentState* document_state, |
215 bool data_reduction_proxy_was_used, | 215 bool data_reduction_proxy_was_used, |
| 216 data_reduction_proxy::AutoLoFiStatus auto_lofi_status, |
216 bool came_from_websearch, | 217 bool came_from_websearch, |
217 int websearch_chrome_joint_experiment_id, | 218 int websearch_chrome_joint_experiment_id, |
218 bool is_preview, | 219 bool is_preview, |
219 URLPattern::SchemeMasks scheme_type) { | 220 URLPattern::SchemeMasks scheme_type) { |
220 // This function records new histograms based on the Navigation Timing | 221 // This function records new histograms based on the Navigation Timing |
221 // records. As such, the histograms should not depend on the deprecated timing | 222 // records. As such, the histograms should not depend on the deprecated timing |
222 // information collected in DocumentState. However, here for some reason we | 223 // information collected in DocumentState. However, here for some reason we |
223 // check if document_state->request_time() is null. TODO(ppi): find out why | 224 // check if document_state->request_time() is null. TODO(ppi): find out why |
224 // and remove DocumentState from the parameter list. | 225 // and remove DocumentState from the parameter list. |
225 Time request = document_state->request_time(); | 226 Time request = document_state->request_time(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (data_reduction_proxy_was_used) { | 406 if (data_reduction_proxy_was_used) { |
406 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 407 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
407 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", | 408 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", |
408 load_event_end - begin); | 409 load_event_end - begin); |
409 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", | 410 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", |
410 load_event_end - response_start); | 411 load_event_end - response_start); |
411 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", | 412 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", |
412 load_event_end - navigation_start); | 413 load_event_end - navigation_start); |
413 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", | 414 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", |
414 load_event_end - request_start); | 415 load_event_end - request_start); |
| 416 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) { |
| 417 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_LoFiOn", |
| 418 load_event_end - begin); |
| 419 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_LoFiOn", |
| 420 load_event_end - response_start); |
| 421 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_LoFiOn", |
| 422 load_event_end - navigation_start); |
| 423 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_LoFiOn", |
| 424 load_event_end - request_start); |
| 425 } else if (auto_lofi_status == |
| 426 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) { |
| 427 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_LoFiOff", |
| 428 load_event_end - begin); |
| 429 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_LoFiOff", |
| 430 load_event_end - response_start); |
| 431 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_LoFiOff", |
| 432 load_event_end - navigation_start); |
| 433 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_LoFiOff", |
| 434 load_event_end - request_start); |
| 435 } |
415 } else { | 436 } else { |
416 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", | 437 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", |
417 load_event_end - begin); | 438 load_event_end - begin); |
418 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", | 439 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", |
419 load_event_end - response_start); | 440 load_event_end - response_start); |
420 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", | 441 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", |
421 load_event_end - navigation_start); | 442 load_event_end - navigation_start); |
422 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", | 443 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", |
423 load_event_end - request_start); | 444 load_event_end - request_start); |
| 445 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) { |
| 446 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_LoFiOn", |
| 447 load_event_end - begin); |
| 448 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_LoFiOn", |
| 449 load_event_end - response_start); |
| 450 PLT_HISTOGRAM( |
| 451 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_LoFiOn", |
| 452 load_event_end - navigation_start); |
| 453 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy_LoFiOn", |
| 454 load_event_end - request_start); |
| 455 } else if (auto_lofi_status == |
| 456 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) { |
| 457 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_LoFiOff", |
| 458 load_event_end - begin); |
| 459 PLT_HISTOGRAM( |
| 460 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_LoFiOff", |
| 461 load_event_end - response_start); |
| 462 PLT_HISTOGRAM( |
| 463 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_LoFiOff", |
| 464 load_event_end - navigation_start); |
| 465 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy_LoFiOff", |
| 466 load_event_end - request_start); |
| 467 } |
424 } | 468 } |
425 } | 469 } |
426 } | 470 } |
427 if (!load_event_start.is_null() && !load_event_end.is_null()) { | 471 if (!load_event_start.is_null() && !load_event_end.is_null()) { |
428 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", | 472 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", |
429 load_event_end - load_event_start); | 473 load_event_end - load_event_start); |
430 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", | 474 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", |
431 load_event_end - load_event_start, | 475 load_event_end - load_event_start, |
432 data_reduction_proxy_was_used, | 476 data_reduction_proxy_was_used, |
433 scheme_type); | 477 scheme_type); |
(...skipping 11 matching lines...) Expand all Loading... |
445 if (!dom_content_loaded_start.is_null()) { | 489 if (!dom_content_loaded_start.is_null()) { |
446 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", | 490 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", |
447 dom_content_loaded_start - navigation_start, | 491 dom_content_loaded_start - navigation_start, |
448 came_from_websearch, | 492 came_from_websearch, |
449 websearch_chrome_joint_experiment_id, | 493 websearch_chrome_joint_experiment_id, |
450 is_preview); | 494 is_preview); |
451 if (data_reduction_proxy_was_used) { | 495 if (data_reduction_proxy_was_used) { |
452 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 496 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
453 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", | 497 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", |
454 dom_content_loaded_start - navigation_start); | 498 dom_content_loaded_start - navigation_start); |
| 499 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) { |
| 500 PLT_HISTOGRAM( |
| 501 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_LoFiOn", |
| 502 dom_content_loaded_start - navigation_start); |
| 503 } else if (auto_lofi_status == |
| 504 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) { |
| 505 PLT_HISTOGRAM( |
| 506 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_LoFiOff", |
| 507 dom_content_loaded_start - navigation_start); |
| 508 } |
455 } else { | 509 } else { |
456 PLT_HISTOGRAM( | 510 PLT_HISTOGRAM( |
457 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", | 511 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", |
458 dom_content_loaded_start - navigation_start); | 512 dom_content_loaded_start - navigation_start); |
| 513 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) { |
| 514 PLT_HISTOGRAM( |
| 515 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
| 516 "LoFiOn", |
| 517 dom_content_loaded_start - navigation_start); |
| 518 } else if (auto_lofi_status == |
| 519 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) { |
| 520 PLT_HISTOGRAM( |
| 521 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
| 522 "LoFiOff", |
| 523 dom_content_loaded_start - navigation_start); |
| 524 } |
459 } | 525 } |
460 } | 526 } |
461 } | 527 } |
462 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", | 528 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", |
463 response_start - begin, | 529 response_start - begin, |
464 came_from_websearch, | 530 came_from_websearch, |
465 websearch_chrome_joint_experiment_id, | 531 websearch_chrome_joint_experiment_id, |
466 is_preview); | 532 is_preview); |
467 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", | 533 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", |
468 request_start - navigation_start, | 534 request_start - navigation_start, |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 return; | 811 return; |
746 | 812 |
747 // Ignore multipart requests. | 813 // Ignore multipart requests. |
748 if (frame->dataSource()->response().isMultipartPayload()) | 814 if (frame->dataSource()->response().isMultipartPayload()) |
749 return; | 815 return; |
750 | 816 |
751 DocumentState* document_state = | 817 DocumentState* document_state = |
752 DocumentState::FromDataSource(frame->dataSource()); | 818 DocumentState::FromDataSource(frame->dataSource()); |
753 | 819 |
754 bool data_reduction_proxy_was_used = false; | 820 bool data_reduction_proxy_was_used = false; |
| 821 enum data_reduction_proxy::AutoLoFiStatus auto_lofi_status = |
| 822 data_reduction_proxy::AUTO_LOFI_STATUS_DISABLED; |
755 if (!document_state->proxy_server().IsEmpty()) { | 823 if (!document_state->proxy_server().IsEmpty()) { |
756 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( | 824 Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus( |
757 document_state->proxy_server(), &data_reduction_proxy_was_used)); | 825 document_state->proxy_server(), &data_reduction_proxy_was_used, |
| 826 &auto_lofi_status)); |
758 } | 827 } |
759 | 828 |
760 bool came_from_websearch = | 829 bool came_from_websearch = |
761 IsFromGoogleSearchResult(frame->document().url(), | 830 IsFromGoogleSearchResult(frame->document().url(), |
762 GURL(frame->document().referrer())); | 831 GURL(frame->document().referrer())); |
763 int websearch_chrome_joint_experiment_id = kNoExperiment; | 832 int websearch_chrome_joint_experiment_id = kNoExperiment; |
764 bool is_preview = false; | 833 bool is_preview = false; |
765 if (came_from_websearch) { | 834 if (came_from_websearch) { |
766 websearch_chrome_joint_experiment_id = | 835 websearch_chrome_joint_experiment_id = |
767 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); | 836 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); |
768 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 837 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
769 } | 838 } |
770 | 839 |
771 // Metrics based on the timing information recorded for the Navigation Timing | 840 // Metrics based on the timing information recorded for the Navigation Timing |
772 // API - http://www.w3.org/TR/navigation-timing/. | 841 // API - http://www.w3.org/TR/navigation-timing/. |
773 DumpHistograms(frame->performance(), document_state, | 842 DumpHistograms(frame->performance(), document_state, |
774 data_reduction_proxy_was_used, | 843 data_reduction_proxy_was_used, auto_lofi_status, |
775 came_from_websearch, | 844 came_from_websearch, websearch_chrome_joint_experiment_id, |
776 websearch_chrome_joint_experiment_id, | 845 is_preview, scheme_type); |
777 is_preview, | |
778 scheme_type); | |
779 | 846 |
780 // Old metrics based on the timing information stored in DocumentState. These | 847 // Old metrics based on the timing information stored in DocumentState. These |
781 // are deprecated and should go away. | 848 // are deprecated and should go away. |
782 DumpDeprecatedHistograms(frame->performance(), document_state, | 849 DumpDeprecatedHistograms(frame->performance(), document_state, |
783 data_reduction_proxy_was_used, | 850 data_reduction_proxy_was_used, |
784 came_from_websearch, | 851 came_from_websearch, |
785 websearch_chrome_joint_experiment_id, | 852 websearch_chrome_joint_experiment_id, |
786 is_preview, | 853 is_preview, |
787 scheme_type); | 854 scheme_type); |
788 | 855 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 | 888 |
822 DCHECK(document_state); | 889 DCHECK(document_state); |
823 DCHECK(ds); | 890 DCHECK(ds); |
824 GURL url(ds->request().url()); | 891 GURL url(ds->request().url()); |
825 Time start = document_state->start_load_time(); | 892 Time start = document_state->start_load_time(); |
826 Time finish = document_state->finish_load_time(); | 893 Time finish = document_state->finish_load_time(); |
827 // TODO(mbelshe): should we log more stats? | 894 // TODO(mbelshe): should we log more stats? |
828 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 895 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
829 << url.spec(); | 896 << url.spec(); |
830 } | 897 } |
OLD | NEW |