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

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

Issue 2724403004: NQE: Add net log event if the metric changes substantially (Closed)
Patch Set: ryansturm comments Created 3 years, 9 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/event_creator_unittest.cc ('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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 bool disable_offline_check) { 788 bool disable_offline_check) {
789 DCHECK(thread_checker_.CalledOnValidThread()); 789 DCHECK(thread_checker_.CalledOnValidThread());
790 disable_offline_check_ = disable_offline_check; 790 disable_offline_check_ = disable_offline_check;
791 network_quality_store_->DisableOfflineCheckForTesting(disable_offline_check_); 791 network_quality_store_->DisableOfflineCheckForTesting(disable_offline_check_);
792 } 792 }
793 793
794 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting( 794 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting(
795 EffectiveConnectionType effective_connection_type) { 795 EffectiveConnectionType effective_connection_type) {
796 DCHECK(thread_checker_.CalledOnValidThread()); 796 DCHECK(thread_checker_.CalledOnValidThread());
797 797
798 event_creator_.MaybeAddEffectiveConnectionTypeChangedEventToNetLog( 798 event_creator_.MaybeAddNetworkQualityChangedEventToNetLog(
799 effective_connection_type_, 799 effective_connection_type_,
800 typical_network_quality_[effective_connection_type]); 800 typical_network_quality_[effective_connection_type]);
801 801
802 for (auto& observer : effective_connection_type_observer_list_) 802 for (auto& observer : effective_connection_type_observer_list_)
803 observer.OnEffectiveConnectionTypeChanged(effective_connection_type); 803 observer.OnEffectiveConnectionTypeChanged(effective_connection_type);
804 804
805 network_quality_store_->Add(current_network_id_, 805 network_quality_store_->Add(current_network_id_,
806 nqe::internal::CachedNetworkQuality( 806 nqe::internal::CachedNetworkQuality(
807 tick_clock_->NowTicks(), network_quality_, 807 tick_clock_->NowTicks(), network_quality_,
808 effective_connection_type)); 808 effective_connection_type));
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 nqe::internal::INVALID_RTT_THROUGHPUT) { 1097 nqe::internal::INVALID_RTT_THROUGHPUT) {
1098 UMA_HISTOGRAM_COUNTS_1M("NQE.Kbps.OnECTComputation", 1098 UMA_HISTOGRAM_COUNTS_1M("NQE.Kbps.OnECTComputation",
1099 network_quality_.downstream_throughput_kbps()); 1099 network_quality_.downstream_throughput_kbps());
1100 } 1100 }
1101 1101
1102 NotifyObserversOfRTTOrThroughputComputed(); 1102 NotifyObserversOfRTTOrThroughputComputed();
1103 1103
1104 if (past_type != effective_connection_type_) 1104 if (past_type != effective_connection_type_)
1105 NotifyObserversOfEffectiveConnectionTypeChanged(); 1105 NotifyObserversOfEffectiveConnectionTypeChanged();
1106 1106
1107 event_creator_.MaybeAddEffectiveConnectionTypeChangedEventToNetLog( 1107 event_creator_.MaybeAddNetworkQualityChangedEventToNetLog(
1108 effective_connection_type_, network_quality_); 1108 effective_connection_type_, network_quality_);
1109 1109
1110 rtt_observations_size_at_last_ect_computation_ = rtt_observations_.Size(); 1110 rtt_observations_size_at_last_ect_computation_ = rtt_observations_.Size();
1111 throughput_observations_size_at_last_ect_computation_ = 1111 throughput_observations_size_at_last_ect_computation_ =
1112 downstream_throughput_kbps_observations_.Size(); 1112 downstream_throughput_kbps_observations_.Size();
1113 } 1113 }
1114 1114
1115 EffectiveConnectionType NetworkQualityEstimator::GetEffectiveConnectionType() 1115 EffectiveConnectionType NetworkQualityEstimator::GetEffectiveConnectionType()
1116 const { 1116 const {
1117 DCHECK(thread_checker_.CalledOnValidThread()); 1117 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 return "UnweightedAverage"; 1812 return "UnweightedAverage";
1813 case STATISTIC_LAST: 1813 case STATISTIC_LAST:
1814 NOTREACHED(); 1814 NOTREACHED();
1815 return ""; 1815 return "";
1816 } 1816 }
1817 NOTREACHED(); 1817 NOTREACHED();
1818 return ""; 1818 return "";
1819 } 1819 }
1820 1820
1821 } // namespace net 1821 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/event_creator_unittest.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698