| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #define PLT_HISTOGRAM(name, sample) \ | 28 #define PLT_HISTOGRAM(name, sample) \ |
| 29 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, kPLTMin, kPLTMax, kPLTCount); | 29 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, kPLTMin, kPLTMax, kPLTCount); |
| 30 | 30 |
| 31 // Returns the scheme type of the given URL if its type is one for which we | 31 // Returns the scheme type of the given URL if its type is one for which we |
| 32 // dump page load histograms. Otherwise returns NULL. | 32 // dump page load histograms. Otherwise returns NULL. |
| 33 static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { | 33 static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { |
| 34 if (url.SchemeIs("http")) | 34 if (url.SchemeIs("http")) |
| 35 return URLPattern::SCHEME_HTTP; | 35 return URLPattern::SCHEME_HTTP; |
| 36 else if (url.SchemeIs("https")) | 36 else if (url.SchemeIs("https")) |
| 37 return URLPattern::SCHEME_HTTPS; | 37 return URLPattern::SCHEME_HTTPS; |
| 38 else if (url.SchemeIs("httpsv")) |
| 39 return URLPattern::SCHEME_HTTPSV; |
| 38 return static_cast<URLPattern::SchemeMasks>(0); | 40 return static_cast<URLPattern::SchemeMasks>(0); |
| 39 } | 41 } |
| 40 | 42 |
| 41 static void DumpWebTiming(const Time& navigation_start, | 43 static void DumpWebTiming(const Time& navigation_start, |
| 42 const Time& load_event_start, | 44 const Time& load_event_start, |
| 43 const Time& load_event_end, | 45 const Time& load_event_end, |
| 44 NavigationState* navigation_state) { | 46 NavigationState* navigation_state) { |
| 45 if (navigation_start.is_null() || | 47 if (navigation_start.is_null() || |
| 46 load_event_start.is_null() || | 48 load_event_start.is_null() || |
| 47 load_event_end.is_null()) | 49 load_event_end.is_null()) |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 "SpdyImpact")->group_name() == "npn_with_spdy"; | 591 "SpdyImpact")->group_name() == "npn_with_spdy"; |
| 590 static bool in_http_trial = base::FieldTrialList::Find( | 592 static bool in_http_trial = base::FieldTrialList::Find( |
| 591 "SpdyImpact")->group_name() == "npn_with_http"; | 593 "SpdyImpact")->group_name() == "npn_with_http"; |
| 592 | 594 |
| 593 bool spdy_trial_success = navigation_state->was_fetched_via_spdy() ? | 595 bool spdy_trial_success = navigation_state->was_fetched_via_spdy() ? |
| 594 in_spdy_trial : in_http_trial; | 596 in_spdy_trial : in_http_trial; |
| 595 if (spdy_trial_success) { | 597 if (spdy_trial_success) { |
| 596 // Histograms to determine if SPDY has an impact for https traffic. | 598 // Histograms to determine if SPDY has an impact for https traffic. |
| 597 // TODO(mbelshe): After we've seen the difference between BeginToFinish | 599 // TODO(mbelshe): After we've seen the difference between BeginToFinish |
| 598 // and StartToFinish, consider removing one or the other. | 600 // and StartToFinish, consider removing one or the other. |
| 599 if (scheme_type == URLPattern::SCHEME_HTTPS && | 601 if ((scheme_type == URLPattern::SCHEME_HTTPS || |
| 602 scheme_type == URLPattern::SCHEME_HTTPSV) && |
| 600 navigation_state->was_npn_negotiated()) { | 603 navigation_state->was_npn_negotiated()) { |
| 601 UMA_HISTOGRAM_ENUMERATION( | 604 UMA_HISTOGRAM_ENUMERATION( |
| 602 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), | 605 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), |
| 603 abandoned_page ? 1 : 0, 2); | 606 abandoned_page ? 1 : 0, 2); |
| 604 switch (load_type) { | 607 switch (load_type) { |
| 605 case NavigationState::LINK_LOAD_NORMAL: | 608 case NavigationState::LINK_LOAD_NORMAL: |
| 606 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 609 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
| 607 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), | 610 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), |
| 608 begin_to_finish_all_loads); | 611 begin_to_finish_all_loads); |
| 609 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 612 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), | 710 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), |
| 708 start_to_commit); | 711 start_to_commit); |
| 709 break; | 712 break; |
| 710 default: | 713 default: |
| 711 break; | 714 break; |
| 712 } | 715 } |
| 713 } | 716 } |
| 714 | 717 |
| 715 // Record page load time and abandonment rates for proxy cases. | 718 // Record page load time and abandonment rates for proxy cases. |
| 716 if (navigation_state->was_fetched_via_proxy()) { | 719 if (navigation_state->was_fetched_via_proxy()) { |
| 717 if (scheme_type == URLPattern::SCHEME_HTTPS) { | 720 if (scheme_type == URLPattern::SCHEME_HTTPS || |
| 721 scheme_type == URLPattern::SCHEME_HTTPSV) { |
| 718 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); | 722 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); |
| 719 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", | 723 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", |
| 720 abandoned_page ? 1 : 0, 2); | 724 abandoned_page ? 1 : 0, 2); |
| 721 } else { | 725 } else { |
| 722 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); | 726 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); |
| 723 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); | 727 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); |
| 724 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", | 728 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", |
| 725 abandoned_page ? 1 : 0, 2); | 729 abandoned_page ? 1 : 0, 2); |
| 726 } | 730 } |
| 727 } else { | 731 } else { |
| 728 if (scheme_type == URLPattern::SCHEME_HTTPS) { | 732 if (scheme_type == URLPattern::SCHEME_HTTPS || |
| 733 scheme_type == URLPattern::SCHEME_HTTPSV) { |
| 729 PLT_HISTOGRAM("PLT.StartToFinish.NoProxy.https", | 734 PLT_HISTOGRAM("PLT.StartToFinish.NoProxy.https", |
| 730 start_to_finish_all_loads); | 735 start_to_finish_all_loads); |
| 731 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.NoProxy.https", | 736 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.NoProxy.https", |
| 732 abandoned_page ? 1 : 0, 2); | 737 abandoned_page ? 1 : 0, 2); |
| 733 } else { | 738 } else { |
| 734 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); | 739 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); |
| 735 PLT_HISTOGRAM("PLT.StartToFinish.NoProxy.http", | 740 PLT_HISTOGRAM("PLT.StartToFinish.NoProxy.http", |
| 736 start_to_finish_all_loads); | 741 start_to_finish_all_loads); |
| 737 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.NoProxy.http", | 742 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.NoProxy.http", |
| 738 abandoned_page ? 1 : 0, 2); | 743 abandoned_page ? 1 : 0, 2); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 788 |
| 784 DCHECK(state); | 789 DCHECK(state); |
| 785 DCHECK(ds); | 790 DCHECK(ds); |
| 786 GURL url(ds->request().url()); | 791 GURL url(ds->request().url()); |
| 787 Time start = state->start_load_time(); | 792 Time start = state->start_load_time(); |
| 788 Time finish = state->finish_load_time(); | 793 Time finish = state->finish_load_time(); |
| 789 // TODO(mbelshe): should we log more stats? | 794 // TODO(mbelshe): should we log more stats? |
| 790 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 795 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 791 << url.spec(); | 796 << url.spec(); |
| 792 } | 797 } |
| OLD | NEW |