Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1331)

Side by Side Diff: chrome/renderer/page_load_histograms.cc

Issue 1140443002: Modify IPC call to properly record the PLT histograms for LoFi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Alexei's comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_AutoLoFiOn",
418 load_event_end - begin);
419 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn",
420 load_event_end - response_start);
421 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn",
422 load_event_end - navigation_start);
423 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn",
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_AutoLoFiOff",
428 load_event_end - begin);
429 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff",
430 load_event_end - response_start);
431 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff",
432 load_event_end - navigation_start);
433 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff",
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(
447 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
448 load_event_end - begin);
449 PLT_HISTOGRAM(
450 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
451 load_event_end - response_start);
452 PLT_HISTOGRAM(
453 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
454 load_event_end - navigation_start);
455 PLT_HISTOGRAM(
456 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
457 load_event_end - request_start);
458 } else if (auto_lofi_status ==
459 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) {
460 PLT_HISTOGRAM(
461 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
462 load_event_end - begin);
463 PLT_HISTOGRAM(
464 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
465 load_event_end - response_start);
466 PLT_HISTOGRAM(
467 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
468 load_event_end - navigation_start);
469 PLT_HISTOGRAM(
470 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
471 load_event_end - request_start);
472 }
424 } 473 }
425 } 474 }
426 } 475 }
427 if (!load_event_start.is_null() && !load_event_end.is_null()) { 476 if (!load_event_start.is_null() && !load_event_end.is_null()) {
428 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", 477 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish",
429 load_event_end - load_event_start); 478 load_event_end - load_event_start);
430 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent", 479 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent",
431 load_event_end - load_event_start, 480 load_event_end - load_event_start,
432 data_reduction_proxy_was_used, 481 data_reduction_proxy_was_used,
433 scheme_type); 482 scheme_type);
(...skipping 11 matching lines...) Expand all
445 if (!dom_content_loaded_start.is_null()) { 494 if (!dom_content_loaded_start.is_null()) {
446 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", 495 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded",
447 dom_content_loaded_start - navigation_start, 496 dom_content_loaded_start - navigation_start,
448 came_from_websearch, 497 came_from_websearch,
449 websearch_chrome_joint_experiment_id, 498 websearch_chrome_joint_experiment_id,
450 is_preview); 499 is_preview);
451 if (data_reduction_proxy_was_used) { 500 if (data_reduction_proxy_was_used) {
452 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { 501 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) {
453 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", 502 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy",
454 dom_content_loaded_start - navigation_start); 503 dom_content_loaded_start - navigation_start);
504 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) {
505 PLT_HISTOGRAM(
506 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn",
507 dom_content_loaded_start - navigation_start);
508 } else if (auto_lofi_status ==
509 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) {
510 PLT_HISTOGRAM(
511 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff",
512 dom_content_loaded_start - navigation_start);
513 }
455 } else { 514 } else {
456 PLT_HISTOGRAM( 515 PLT_HISTOGRAM(
457 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", 516 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy",
458 dom_content_loaded_start - navigation_start); 517 dom_content_loaded_start - navigation_start);
518 if (auto_lofi_status == data_reduction_proxy::AUTO_LOFI_STATUS_ON) {
519 PLT_HISTOGRAM(
520 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
521 "AutoLoFiOn",
522 dom_content_loaded_start - navigation_start);
523 } else if (auto_lofi_status ==
524 data_reduction_proxy::AUTO_LOFI_STATUS_OFF) {
525 PLT_HISTOGRAM(
526 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
527 "AutoLoFiOff",
528 dom_content_loaded_start - navigation_start);
529 }
459 } 530 }
460 } 531 }
461 } 532 }
462 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", 533 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit",
463 response_start - begin, 534 response_start - begin,
464 came_from_websearch, 535 came_from_websearch,
465 websearch_chrome_joint_experiment_id, 536 websearch_chrome_joint_experiment_id,
466 is_preview); 537 is_preview);
467 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", 538 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart",
468 request_start - navigation_start, 539 request_start - navigation_start,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return; 816 return;
746 817
747 // Ignore multipart requests. 818 // Ignore multipart requests.
748 if (frame->dataSource()->response().isMultipartPayload()) 819 if (frame->dataSource()->response().isMultipartPayload())
749 return; 820 return;
750 821
751 DocumentState* document_state = 822 DocumentState* document_state =
752 DocumentState::FromDataSource(frame->dataSource()); 823 DocumentState::FromDataSource(frame->dataSource());
753 824
754 bool data_reduction_proxy_was_used = false; 825 bool data_reduction_proxy_was_used = false;
826 enum data_reduction_proxy::AutoLoFiStatus auto_lofi_status =
jeremyim 2015/05/13 23:12:08 Remove enum keyword.
tbansal1 2015/05/13 23:51:39 Done.
827 data_reduction_proxy::AUTO_LOFI_STATUS_DISABLED;
755 if (!document_state->proxy_server().IsEmpty()) { 828 if (!document_state->proxy_server().IsEmpty()) {
756 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( 829 Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus(
757 document_state->proxy_server(), &data_reduction_proxy_was_used)); 830 document_state->proxy_server(), &data_reduction_proxy_was_used,
831 &auto_lofi_status));
758 } 832 }
759 833
760 bool came_from_websearch = 834 bool came_from_websearch =
761 IsFromGoogleSearchResult(frame->document().url(), 835 IsFromGoogleSearchResult(frame->document().url(),
762 GURL(frame->document().referrer())); 836 GURL(frame->document().referrer()));
763 int websearch_chrome_joint_experiment_id = kNoExperiment; 837 int websearch_chrome_joint_experiment_id = kNoExperiment;
764 bool is_preview = false; 838 bool is_preview = false;
765 if (came_from_websearch) { 839 if (came_from_websearch) {
766 websearch_chrome_joint_experiment_id = 840 websearch_chrome_joint_experiment_id =
767 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); 841 GetQueryStringBasedExperiment(GURL(frame->document().referrer()));
768 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); 842 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview");
769 } 843 }
770 844
771 // Metrics based on the timing information recorded for the Navigation Timing 845 // Metrics based on the timing information recorded for the Navigation Timing
772 // API - http://www.w3.org/TR/navigation-timing/. 846 // API - http://www.w3.org/TR/navigation-timing/.
773 DumpHistograms(frame->performance(), document_state, 847 DumpHistograms(frame->performance(), document_state,
774 data_reduction_proxy_was_used, 848 data_reduction_proxy_was_used, auto_lofi_status,
775 came_from_websearch, 849 came_from_websearch, websearch_chrome_joint_experiment_id,
776 websearch_chrome_joint_experiment_id, 850 is_preview, scheme_type);
777 is_preview,
778 scheme_type);
779 851
780 // Old metrics based on the timing information stored in DocumentState. These 852 // Old metrics based on the timing information stored in DocumentState. These
781 // are deprecated and should go away. 853 // are deprecated and should go away.
782 DumpDeprecatedHistograms(frame->performance(), document_state, 854 DumpDeprecatedHistograms(frame->performance(), document_state,
783 data_reduction_proxy_was_used, 855 data_reduction_proxy_was_used,
784 came_from_websearch, 856 came_from_websearch,
785 websearch_chrome_joint_experiment_id, 857 websearch_chrome_joint_experiment_id,
786 is_preview, 858 is_preview,
787 scheme_type); 859 scheme_type);
788 860
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 893
822 DCHECK(document_state); 894 DCHECK(document_state);
823 DCHECK(ds); 895 DCHECK(ds);
824 GURL url(ds->request().url()); 896 GURL url(ds->request().url());
825 Time start = document_state->start_load_time(); 897 Time start = document_state->start_load_time();
826 Time finish = document_state->finish_load_time(); 898 Time finish = document_state->finish_load_time();
827 // TODO(mbelshe): should we log more stats? 899 // TODO(mbelshe): should we log more stats?
828 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 900 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
829 << url.spec(); 901 << url.spec();
830 } 902 }
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698