| 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 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 private: | 274 private: |
| 275 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 275 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
| 276 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 276 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
| 277 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); | 277 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); |
| 278 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | 278 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
| 279 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); | 279 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
| 280 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); | 280 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); |
| 281 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 281 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 282 TestLRUCacheMaximumSize); | 282 TestLRUCacheMaximumSize); |
| 283 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMedianRTTSince); | 283 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince); |
| 284 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 284 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 285 TestExternalEstimateProviderMergeEstimates); | 285 TestExternalEstimateProviderMergeEstimates); |
| 286 | 286 |
| 287 class SocketWatcher; | 287 class SocketWatcher; |
| 288 class SocketWatcherFactory; | 288 class SocketWatcherFactory; |
| 289 | 289 |
| 290 // Value of round trip time observations is in base::TimeDelta. | 290 // Value of round trip time observations is in base::TimeDelta. |
| 291 typedef nqe::internal::Observation<base::TimeDelta> RttObservation; | 291 typedef nqe::internal::Observation<base::TimeDelta> RttObservation; |
| 292 typedef nqe::internal::ObservationBuffer<base::TimeDelta> | 292 typedef nqe::internal::ObservationBuffer<base::TimeDelta> |
| 293 RttObservationBuffer; | 293 RttObservationBuffer; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // the field trial parameters. For each effective connection type, a model | 348 // the field trial parameters. For each effective connection type, a model |
| 349 // (currently composed of a RTT threshold and a downlink throughput threshold) | 349 // (currently composed of a RTT threshold and a downlink throughput threshold) |
| 350 // is provided by the field trial. | 350 // is provided by the field trial. |
| 351 void ObtainEffectiveConnectionTypeModelParams( | 351 void ObtainEffectiveConnectionTypeModelParams( |
| 352 const std::map<std::string, std::string>& variation_params); | 352 const std::map<std::string, std::string>& variation_params); |
| 353 | 353 |
| 354 // Adds the default median RTT and downstream throughput estimate for the | 354 // Adds the default median RTT and downstream throughput estimate for the |
| 355 // current connection type to the observation buffer. | 355 // current connection type to the observation buffer. |
| 356 void AddDefaultEstimates(); | 356 void AddDefaultEstimates(); |
| 357 | 357 |
| 358 // Returns the effective type of the current connection based on only the |
| 359 // samples observed after |start_time|. |
| 360 EffectiveConnectionType GetRecentEffectiveConnectionType( |
| 361 const base::TimeTicks& start_time) const; |
| 362 |
| 358 // Returns an estimate of network quality at the specified |percentile|. | 363 // Returns an estimate of network quality at the specified |percentile|. |
| 359 // |disallowed_observation_sources| is the list of observation sources that | 364 // |disallowed_observation_sources| is the list of observation sources that |
| 360 // should be excluded when computing the percentile. | 365 // should be excluded when computing the percentile. |
| 361 // Only the observations later than |start_time| are taken into account. | 366 // Only the observations later than |start_time| are taken into account. |
| 362 // |percentile| must be between 0 and 100 (both inclusive) with higher | 367 // |percentile| must be between 0 and 100 (both inclusive) with higher |
| 363 // percentiles indicating less performant networks. For example, if | 368 // percentiles indicating less performant networks. For example, if |
| 364 // |percentile| is 90, then the network is expected to be faster than the | 369 // |percentile| is 90, then the network is expected to be faster than the |
| 365 // returned estimate with 0.9 probability. Similarly, network is expected to | 370 // returned estimate with 0.9 probability. Similarly, network is expected to |
| 366 // be slower than the returned estimate with 0.1 probability. | 371 // be slower than the returned estimate with 0.1 probability. |
| 367 base::TimeDelta GetRTTEstimateInternal( | 372 base::TimeDelta GetRTTEstimateInternal( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 base::ThreadChecker thread_checker_; | 485 base::ThreadChecker thread_checker_; |
| 481 | 486 |
| 482 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 487 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 483 | 488 |
| 484 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 489 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 485 }; | 490 }; |
| 486 | 491 |
| 487 } // namespace net | 492 } // namespace net |
| 488 | 493 |
| 489 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 494 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |