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

Side by Side Diff: net/nqe/network_quality_estimator.cc

Issue 2116893002: NQE: Record how frequently NetworkID is available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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 | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "net/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (NetworkChangeNotifier::IsConnectionCellular(current_network_id_.type)) { 774 if (NetworkChangeNotifier::IsConnectionCellular(current_network_id_.type)) {
775 UMA_HISTOGRAM_BOOLEAN( 775 UMA_HISTOGRAM_BOOLEAN(
776 "NQE.CellularSignalStrengthAvailable", 776 "NQE.CellularSignalStrengthAvailable",
777 min_signal_strength_since_connection_change_ != INT32_MAX && 777 min_signal_strength_since_connection_change_ != INT32_MAX &&
778 max_signal_strength_since_connection_change_ != INT32_MIN); 778 max_signal_strength_since_connection_change_ != INT32_MIN);
779 } 779 }
780 #endif // OS_ANDROID 780 #endif // OS_ANDROID
781 min_signal_strength_since_connection_change_ = INT32_MAX; 781 min_signal_strength_since_connection_change_ = INT32_MAX;
782 max_signal_strength_since_connection_change_ = INT32_MIN; 782 max_signal_strength_since_connection_change_ = INT32_MIN;
783 783
784 // Update the local state as part of preparation for the new connection.
784 current_network_id_ = GetCurrentNetworkID(); 785 current_network_id_ = GetCurrentNetworkID();
786 RecordNetworkIDAvailability();
785 787
786 // Query the external estimate provider on certain connection types. Once the 788 // Query the external estimate provider on certain connection types. Once the
787 // updated estimates are available, OnUpdatedEstimateAvailable will be called 789 // updated estimates are available, OnUpdatedEstimateAvailable will be called
788 // by |external_estimate_provider_| with updated estimates. 790 // by |external_estimate_provider_| with updated estimates.
789 if (external_estimate_provider_ && 791 if (external_estimate_provider_ &&
790 current_network_id_.type != NetworkChangeNotifier::CONNECTION_NONE && 792 current_network_id_.type != NetworkChangeNotifier::CONNECTION_NONE &&
791 current_network_id_.type != NetworkChangeNotifier::CONNECTION_UNKNOWN && 793 current_network_id_.type != NetworkChangeNotifier::CONNECTION_UNKNOWN &&
792 current_network_id_.type != NetworkChangeNotifier::CONNECTION_ETHERNET && 794 current_network_id_.type != NetworkChangeNotifier::CONNECTION_ETHERNET &&
793 current_network_id_.type != NetworkChangeNotifier::CONNECTION_BLUETOOTH) { 795 current_network_id_.type != NetworkChangeNotifier::CONNECTION_BLUETOOTH) {
794 RecordExternalEstimateProviderMetrics( 796 RecordExternalEstimateProviderMetrics(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 base::TimeTicks(), kPercentiles[i]); 886 base::TimeTicks(), kPercentiles[i]);
885 887
886 transport_rtt_percentile = GetHistogram( 888 transport_rtt_percentile = GetHistogram(
887 "TransportRTT.Percentile" + base::IntToString(kPercentiles[i]) + ".", 889 "TransportRTT.Percentile" + base::IntToString(kPercentiles[i]) + ".",
888 current_network_id_.type, 10 * 1000); // 10 seconds 890 current_network_id_.type, 10 * 1000); // 10 seconds
889 transport_rtt_percentile->Add(rtt.InMilliseconds()); 891 transport_rtt_percentile->Add(rtt.InMilliseconds());
890 } 892 }
891 } 893 }
892 } 894 }
893 895
896 void NetworkQualityEstimator::RecordNetworkIDAvailability() const {
897 DCHECK(thread_checker_.CalledOnValidThread());
898 if (current_network_id_.type ==
899 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI ||
900 NetworkChangeNotifier::IsConnectionCellular(current_network_id_.type)) {
901 UMA_HISTOGRAM_BOOLEAN("NQE.NetworkIdAvailable",
902 !current_network_id_.id.empty());
903 }
904 }
905
894 void NetworkQualityEstimator::RecordMetricsOnMainFrameRequest() const { 906 void NetworkQualityEstimator::RecordMetricsOnMainFrameRequest() const {
895 DCHECK(thread_checker_.CalledOnValidThread()); 907 DCHECK(thread_checker_.CalledOnValidThread());
896 908
897 base::TimeDelta http_rtt; 909 base::TimeDelta http_rtt;
898 if (GetHttpRTTEstimate(&http_rtt)) { 910 if (GetHttpRTTEstimate(&http_rtt)) {
899 // Add the 50th percentile value. 911 // Add the 50th percentile value.
900 base::HistogramBase* rtt_percentile = GetHistogram( 912 base::HistogramBase* rtt_percentile = GetHistogram(
901 "MainFrame.RTT.Percentile50.", current_network_id_.type, 10 * 1000); 913 "MainFrame.RTT.Percentile50.", current_network_id_.type, 10 * 1000);
902 rtt_percentile->Add(http_rtt.InMilliseconds()); 914 rtt_percentile->Add(http_rtt.InMilliseconds());
903 } 915 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 NotifyObserversOfEffectiveConnectionTypeChanged() { 1484 NotifyObserversOfEffectiveConnectionTypeChanged() {
1473 DCHECK(thread_checker_.CalledOnValidThread()); 1485 DCHECK(thread_checker_.CalledOnValidThread());
1474 1486
1475 // TODO(tbansal): Add hysteresis in the notification. 1487 // TODO(tbansal): Add hysteresis in the notification.
1476 FOR_EACH_OBSERVER( 1488 FOR_EACH_OBSERVER(
1477 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, 1489 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_,
1478 OnEffectiveConnectionTypeChanged(effective_connection_type_)); 1490 OnEffectiveConnectionTypeChanged(effective_connection_type_));
1479 } 1491 }
1480 1492
1481 } // namespace net 1493 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698