| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "PLT.BeginToFinish_LinkLoadCacheOnly", "GlobalSdch"), | 432 "PLT.BeginToFinish_LinkLoadCacheOnly", "GlobalSdch"), |
| 433 begin_to_finish_all_loads); | 433 begin_to_finish_all_loads); |
| 434 break; | 434 break; |
| 435 default: | 435 default: |
| 436 break; | 436 break; |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 // TODO(mpcomplete): remove the extension-related histograms after we collect | 440 // TODO(mpcomplete): remove the extension-related histograms after we collect |
| 441 // enough data. http://crbug.com/100411 | 441 // enough data. http://crbug.com/100411 |
| 442 chrome::ChromeContentRendererClient* client = | 442 const bool use_adblock_histogram = |
| 443 static_cast<chrome::ChromeContentRendererClient*>( | 443 chrome::ChromeContentRendererClient::IsAdblockInstalled(); |
| 444 content::GetContentClient()->renderer()); | |
| 445 | |
| 446 const bool use_adblock_histogram = client->IsAdblockInstalled(); | |
| 447 if (use_adblock_histogram) { | 444 if (use_adblock_histogram) { |
| 448 UMA_HISTOGRAM_ENUMERATION( | 445 UMA_HISTOGRAM_ENUMERATION( |
| 449 "PLT.Abandoned_ExtensionAdblock", | 446 "PLT.Abandoned_ExtensionAdblock", |
| 450 abandoned_page ? 1 : 0, 2); | 447 abandoned_page ? 1 : 0, 2); |
| 451 switch (load_type) { | 448 switch (load_type) { |
| 452 case DocumentState::NORMAL_LOAD: | 449 case DocumentState::NORMAL_LOAD: |
| 453 PLT_HISTOGRAM( | 450 PLT_HISTOGRAM( |
| 454 "PLT.BeginToFinish_NormalLoad_ExtensionAdblock", | 451 "PLT.BeginToFinish_NormalLoad_ExtensionAdblock", |
| 455 begin_to_finish_all_loads); | 452 begin_to_finish_all_loads); |
| 456 break; | 453 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 467 case DocumentState::LINK_LOAD_CACHE_STALE_OK: | 464 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
| 468 PLT_HISTOGRAM( | 465 PLT_HISTOGRAM( |
| 469 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblock", | 466 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblock", |
| 470 begin_to_finish_all_loads); | 467 begin_to_finish_all_loads); |
| 471 break; | 468 break; |
| 472 default: | 469 default: |
| 473 break; | 470 break; |
| 474 } | 471 } |
| 475 } | 472 } |
| 476 | 473 |
| 477 const bool use_adblockplus_histogram = client->IsAdblockPlusInstalled(); | 474 const bool use_adblockplus_histogram = |
| 475 chrome::ChromeContentRendererClient::IsAdblockPlusInstalled(); |
| 478 if (use_adblockplus_histogram) { | 476 if (use_adblockplus_histogram) { |
| 479 UMA_HISTOGRAM_ENUMERATION( | 477 UMA_HISTOGRAM_ENUMERATION( |
| 480 "PLT.Abandoned_ExtensionAdblockPlus", | 478 "PLT.Abandoned_ExtensionAdblockPlus", |
| 481 abandoned_page ? 1 : 0, 2); | 479 abandoned_page ? 1 : 0, 2); |
| 482 switch (load_type) { | 480 switch (load_type) { |
| 483 case DocumentState::NORMAL_LOAD: | 481 case DocumentState::NORMAL_LOAD: |
| 484 PLT_HISTOGRAM( | 482 PLT_HISTOGRAM( |
| 485 "PLT.BeginToFinish_NormalLoad_ExtensionAdblockPlus", | 483 "PLT.BeginToFinish_NormalLoad_ExtensionAdblockPlus", |
| 486 begin_to_finish_all_loads); | 484 begin_to_finish_all_loads); |
| 487 break; | 485 break; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 499 PLT_HISTOGRAM( | 497 PLT_HISTOGRAM( |
| 500 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblockPlus", | 498 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblockPlus", |
| 501 begin_to_finish_all_loads); | 499 begin_to_finish_all_loads); |
| 502 break; | 500 break; |
| 503 default: | 501 default: |
| 504 break; | 502 break; |
| 505 } | 503 } |
| 506 } | 504 } |
| 507 | 505 |
| 508 const bool use_webrequest_adblock_histogram = | 506 const bool use_webrequest_adblock_histogram = |
| 509 client->IsAdblockWithWebRequestInstalled(); | 507 chrome::ChromeContentRendererClient::IsAdblockWithWebRequestInstalled(); |
| 510 if (use_webrequest_adblock_histogram) { | 508 if (use_webrequest_adblock_histogram) { |
| 511 UMA_HISTOGRAM_ENUMERATION( | 509 UMA_HISTOGRAM_ENUMERATION( |
| 512 "PLT.Abandoned_ExtensionWebRequestAdblock", | 510 "PLT.Abandoned_ExtensionWebRequestAdblock", |
| 513 abandoned_page ? 1 : 0, 2); | 511 abandoned_page ? 1 : 0, 2); |
| 514 switch (load_type) { | 512 switch (load_type) { |
| 515 case DocumentState::NORMAL_LOAD: | 513 case DocumentState::NORMAL_LOAD: |
| 516 PLT_HISTOGRAM( | 514 PLT_HISTOGRAM( |
| 517 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblock", | 515 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblock", |
| 518 begin_to_finish_all_loads); | 516 begin_to_finish_all_loads); |
| 519 break; | 517 break; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 531 PLT_HISTOGRAM( | 529 PLT_HISTOGRAM( |
| 532 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblock", | 530 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblock", |
| 533 begin_to_finish_all_loads); | 531 begin_to_finish_all_loads); |
| 534 break; | 532 break; |
| 535 default: | 533 default: |
| 536 break; | 534 break; |
| 537 } | 535 } |
| 538 } | 536 } |
| 539 | 537 |
| 540 const bool use_webrequest_adblockplus_histogram = | 538 const bool use_webrequest_adblockplus_histogram = |
| 541 client->IsAdblockPlusWithWebRequestInstalled(); | 539 chrome::ChromeContentRendererClient:: |
| 540 IsAdblockPlusWithWebRequestInstalled(); |
| 542 if (use_webrequest_adblockplus_histogram) { | 541 if (use_webrequest_adblockplus_histogram) { |
| 543 UMA_HISTOGRAM_ENUMERATION( | 542 UMA_HISTOGRAM_ENUMERATION( |
| 544 "PLT.Abandoned_ExtensionWebRequestAdblockPlus", | 543 "PLT.Abandoned_ExtensionWebRequestAdblockPlus", |
| 545 abandoned_page ? 1 : 0, 2); | 544 abandoned_page ? 1 : 0, 2); |
| 546 switch (load_type) { | 545 switch (load_type) { |
| 547 case DocumentState::NORMAL_LOAD: | 546 case DocumentState::NORMAL_LOAD: |
| 548 PLT_HISTOGRAM( | 547 PLT_HISTOGRAM( |
| 549 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblockPlus", | 548 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblockPlus", |
| 550 begin_to_finish_all_loads); | 549 begin_to_finish_all_loads); |
| 551 break; | 550 break; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 563 PLT_HISTOGRAM( | 562 PLT_HISTOGRAM( |
| 564 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblockPlus", | 563 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblockPlus", |
| 565 begin_to_finish_all_loads); | 564 begin_to_finish_all_loads); |
| 566 break; | 565 break; |
| 567 default: | 566 default: |
| 568 break; | 567 break; |
| 569 } | 568 } |
| 570 } | 569 } |
| 571 | 570 |
| 572 const bool use_webrequest_other_histogram = | 571 const bool use_webrequest_other_histogram = |
| 573 client->IsOtherExtensionWithWebRequestInstalled(); | 572 chrome::ChromeContentRendererClient:: |
| 573 IsOtherExtensionWithWebRequestInstalled(); |
| 574 if (use_webrequest_other_histogram) { | 574 if (use_webrequest_other_histogram) { |
| 575 UMA_HISTOGRAM_ENUMERATION( | 575 UMA_HISTOGRAM_ENUMERATION( |
| 576 "PLT.Abandoned_ExtensionWebRequestOther", | 576 "PLT.Abandoned_ExtensionWebRequestOther", |
| 577 abandoned_page ? 1 : 0, 2); | 577 abandoned_page ? 1 : 0, 2); |
| 578 switch (load_type) { | 578 switch (load_type) { |
| 579 case DocumentState::NORMAL_LOAD: | 579 case DocumentState::NORMAL_LOAD: |
| 580 PLT_HISTOGRAM( | 580 PLT_HISTOGRAM( |
| 581 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestOther", | 581 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestOther", |
| 582 begin_to_finish_all_loads); | 582 begin_to_finish_all_loads); |
| 583 break; | 583 break; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 | 871 |
| 872 DCHECK(document_state); | 872 DCHECK(document_state); |
| 873 DCHECK(ds); | 873 DCHECK(ds); |
| 874 GURL url(ds->request().url()); | 874 GURL url(ds->request().url()); |
| 875 Time start = document_state->start_load_time(); | 875 Time start = document_state->start_load_time(); |
| 876 Time finish = document_state->finish_load_time(); | 876 Time finish = document_state->finish_load_time(); |
| 877 // TODO(mbelshe): should we log more stats? | 877 // TODO(mbelshe): should we log more stats? |
| 878 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 878 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 879 << url.spec(); | 879 << url.spec(); |
| 880 } | 880 } |
| OLD | NEW |