| 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/base/network_quality_estimator.h" | 5 #include "net/base/network_quality_estimator.h" |
| 6 | 6 |
| 7 #include <float.h> | 7 #include <float.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 // Record all the RTT observations. | 396 // Record all the RTT observations. |
| 397 base::HistogramBase* rtt_observations = | 397 base::HistogramBase* rtt_observations = |
| 398 GetHistogram("RTTObservations.", current_network_id_.type, | 398 GetHistogram("RTTObservations.", current_network_id_.type, |
| 399 10 * 1000); // 10 seconds upper bound | 399 10 * 1000); // 10 seconds upper bound |
| 400 rtt_observations->Add(actual_value_msec); | 400 rtt_observations->Add(actual_value_msec); |
| 401 | 401 |
| 402 if (actual_value_msec == 0) | 402 if (actual_value_msec == 0) |
| 403 return; | 403 return; |
| 404 | 404 |
| 405 int32 ratio = (estimated_value_msec * 100) / actual_value_msec; | 405 int32_t ratio = (estimated_value_msec * 100) / actual_value_msec; |
| 406 | 406 |
| 407 // Record the accuracy of estimation by recording the ratio of estimated | 407 // Record the accuracy of estimation by recording the ratio of estimated |
| 408 // value to the actual value. | 408 // value to the actual value. |
| 409 base::HistogramBase* ratio_median_rtt = GetHistogram( | 409 base::HistogramBase* ratio_median_rtt = GetHistogram( |
| 410 "RatioEstimatedToActualRTT.", current_network_id_.type, 1000); | 410 "RatioEstimatedToActualRTT.", current_network_id_.type, 1000); |
| 411 ratio_median_rtt->Add(ratio); | 411 ratio_median_rtt->Add(ratio); |
| 412 } | 412 } |
| 413 | 413 |
| 414 bool NetworkQualityEstimator::RequestProvidesUsefulObservations( | 414 bool NetworkQualityEstimator::RequestProvidesUsefulObservations( |
| 415 const URLRequest& request) const { | 415 const URLRequest& request) const { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1002 |
| 1003 NetworkQualityEstimator::NetworkQuality& | 1003 NetworkQualityEstimator::NetworkQuality& |
| 1004 NetworkQualityEstimator::NetworkQuality:: | 1004 NetworkQualityEstimator::NetworkQuality:: |
| 1005 operator=(const NetworkQuality& other) { | 1005 operator=(const NetworkQuality& other) { |
| 1006 rtt_ = other.rtt_; | 1006 rtt_ = other.rtt_; |
| 1007 downstream_throughput_kbps_ = other.downstream_throughput_kbps_; | 1007 downstream_throughput_kbps_ = other.downstream_throughput_kbps_; |
| 1008 return *this; | 1008 return *this; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 } // namespace net | 1011 } // namespace net |
| OLD | NEW |