| OLD | NEW |
| 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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 !current_network_id_.id.empty()); | 1181 !current_network_id_.id.empty()); |
| 1182 } | 1182 } |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 void NetworkQualityEstimator::RecordMetricsOnMainFrameRequest() const { | 1185 void NetworkQualityEstimator::RecordMetricsOnMainFrameRequest() const { |
| 1186 DCHECK(thread_checker_.CalledOnValidThread()); | 1186 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1187 | 1187 |
| 1188 base::TimeDelta http_rtt; | 1188 base::TimeDelta http_rtt; |
| 1189 if (GetHttpRTT(&http_rtt)) { | 1189 if (GetHttpRTT(&http_rtt)) { |
| 1190 // Add the 50th percentile value. | 1190 // Add the 50th percentile value. |
| 1191 UMA_HISTOGRAM_TIMES("NQE.MainFrame.RTT.Percentile50", http_rtt); |
| 1191 base::HistogramBase* rtt_percentile = GetHistogram( | 1192 base::HistogramBase* rtt_percentile = GetHistogram( |
| 1192 "MainFrame.RTT.Percentile50.", current_network_id_.type, 10 * 1000); | 1193 "MainFrame.RTT.Percentile50.", current_network_id_.type, 10 * 1000); |
| 1193 rtt_percentile->Add(http_rtt.InMilliseconds()); | 1194 rtt_percentile->Add(http_rtt.InMilliseconds()); |
| 1194 } | 1195 } |
| 1195 | 1196 |
| 1196 base::TimeDelta transport_rtt; | 1197 base::TimeDelta transport_rtt; |
| 1197 if (GetTransportRTT(&transport_rtt)) { | 1198 if (GetTransportRTT(&transport_rtt)) { |
| 1198 // Add the 50th percentile value. | 1199 // Add the 50th percentile value. |
| 1200 UMA_HISTOGRAM_TIMES("NQE.MainFrame.TransportRTT.Percentile50", |
| 1201 transport_rtt); |
| 1199 base::HistogramBase* transport_rtt_percentile = | 1202 base::HistogramBase* transport_rtt_percentile = |
| 1200 GetHistogram("MainFrame.TransportRTT.Percentile50.", | 1203 GetHistogram("MainFrame.TransportRTT.Percentile50.", |
| 1201 current_network_id_.type, 10 * 1000); | 1204 current_network_id_.type, 10 * 1000); |
| 1202 transport_rtt_percentile->Add(transport_rtt.InMilliseconds()); | 1205 transport_rtt_percentile->Add(transport_rtt.InMilliseconds()); |
| 1203 } | 1206 } |
| 1204 | 1207 |
| 1205 int32_t kbps; | 1208 int32_t kbps; |
| 1206 if (GetDownlinkThroughputKbps(&kbps)) { | 1209 if (GetDownlinkThroughputKbps(&kbps)) { |
| 1207 // Add the 50th percentile value. | 1210 // Add the 50th percentile value. |
| 1211 UMA_HISTOGRAM_COUNTS_1M("NQE.MainFrame.Kbps.Percentile50", kbps); |
| 1208 base::HistogramBase* throughput_percentile = GetHistogram( | 1212 base::HistogramBase* throughput_percentile = GetHistogram( |
| 1209 "MainFrame.Kbps.Percentile50.", current_network_id_.type, 1000 * 1000); | 1213 "MainFrame.Kbps.Percentile50.", current_network_id_.type, 1000 * 1000); |
| 1210 throughput_percentile->Add(kbps); | 1214 throughput_percentile->Add(kbps); |
| 1211 } | 1215 } |
| 1212 | 1216 |
| 1213 const EffectiveConnectionType effective_connection_type = | 1217 const EffectiveConnectionType effective_connection_type = |
| 1214 GetEffectiveConnectionType(); | 1218 GetEffectiveConnectionType(); |
| 1219 UMA_HISTOGRAM_ENUMERATION("NQE.MainFrame.EffectiveConnectionType", |
| 1220 effective_connection_type, |
| 1221 EFFECTIVE_CONNECTION_TYPE_LAST); |
| 1215 base::HistogramBase* effective_connection_type_histogram = | 1222 base::HistogramBase* effective_connection_type_histogram = |
| 1216 base::Histogram::FactoryGet( | 1223 base::Histogram::FactoryGet( |
| 1217 std::string("NQE.MainFrame.EffectiveConnectionType.") + | 1224 std::string("NQE.MainFrame.EffectiveConnectionType.") + |
| 1218 GetNameForConnectionType(current_network_id_.type), | 1225 GetNameForConnectionType(current_network_id_.type), |
| 1219 0, EFFECTIVE_CONNECTION_TYPE_LAST, | 1226 0, EFFECTIVE_CONNECTION_TYPE_LAST, |
| 1220 EFFECTIVE_CONNECTION_TYPE_LAST /* Number of buckets */, | 1227 EFFECTIVE_CONNECTION_TYPE_LAST /* Number of buckets */, |
| 1221 base::HistogramBase::kUmaTargetedHistogramFlag); | 1228 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 1222 | 1229 |
| 1223 effective_connection_type_histogram->Add(effective_connection_type); | 1230 effective_connection_type_histogram->Add(effective_connection_type); |
| 1224 } | 1231 } |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 void NetworkQualityEstimator::OnPrefsRead( | 1814 void NetworkQualityEstimator::OnPrefsRead( |
| 1808 const std::map<nqe::internal::NetworkID, | 1815 const std::map<nqe::internal::NetworkID, |
| 1809 nqe::internal::CachedNetworkQuality> read_prefs) { | 1816 nqe::internal::CachedNetworkQuality> read_prefs) { |
| 1810 DCHECK(thread_checker_.CalledOnValidThread()); | 1817 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1811 UMA_HISTOGRAM_COUNTS("NQE.Prefs.ReadSize", read_prefs.size()); | 1818 UMA_HISTOGRAM_COUNTS("NQE.Prefs.ReadSize", read_prefs.size()); |
| 1812 // TODO(tbansal): crbug.com/490870. Incorporate the network quality into the | 1819 // TODO(tbansal): crbug.com/490870. Incorporate the network quality into the |
| 1813 // current estimates. | 1820 // current estimates. |
| 1814 } | 1821 } |
| 1815 | 1822 |
| 1816 } // namespace net | 1823 } // namespace net |
| OLD | NEW |