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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 | 448 |
449 private: | 449 private: |
450 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 450 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
451 AdaptiveRecomputationEffectiveConnectionType); | 451 AdaptiveRecomputationEffectiveConnectionType); |
452 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 452 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
453 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 453 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
454 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 454 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
455 DefaultObservationsOverridden); | 455 DefaultObservationsOverridden); |
456 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 456 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
457 ObtainAlgorithmToUseFromParams); | 457 ObtainAlgorithmToUseFromParams); |
458 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | |
459 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); | 458 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
460 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince); | 459 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince); |
461 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 460 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
462 TestExternalEstimateProviderMergeEstimates); | 461 TestExternalEstimateProviderMergeEstimates); |
463 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 462 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
464 UnknownEffectiveConnectionType); | 463 UnknownEffectiveConnectionType); |
465 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 464 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
466 TypicalNetworkQualities); | 465 TypicalNetworkQualities); |
467 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 466 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
468 OnPrefsReadWithReadingDisabled); | 467 OnPrefsReadWithReadingDisabled); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 // network quality. Set to true only for tests. | 661 // network quality. Set to true only for tests. |
663 bool use_small_responses_; | 662 bool use_small_responses_; |
664 | 663 |
665 // When set to true, the device offline check is disabled when computing the | 664 // When set to true, the device offline check is disabled when computing the |
666 // effective connection type or when writing the prefs. | 665 // effective connection type or when writing the prefs. |
667 bool disable_offline_check_; | 666 bool disable_offline_check_; |
668 | 667 |
669 // If true, default values provided by the platform are used for estimation. | 668 // If true, default values provided by the platform are used for estimation. |
670 const bool add_default_platform_observations_; | 669 const bool add_default_platform_observations_; |
671 | 670 |
672 // The factor by which the weight of an observation reduces every second. | |
673 const double weight_multiplier_per_second_; | |
674 | |
675 // The factor by which the weight of an observation reduces for every dBm | |
676 // difference between the current signal strength (in dBm), and the signal | |
677 // strength at the time when the observation was taken. | |
678 const double weight_multiplier_per_dbm_; | |
679 | |
680 // Algorithm to use for computing effective connection type. The value is | 671 // Algorithm to use for computing effective connection type. The value is |
681 // obtained from field trial parameters. If the value from field trial | 672 // obtained from field trial parameters. If the value from field trial |
682 // parameters is unavailable, it is set to | 673 // parameters is unavailable, it is set to |
683 // kDefaultEffectiveConnectionTypeAlgorithm. | 674 // kDefaultEffectiveConnectionTypeAlgorithm. |
684 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; | 675 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; |
685 | 676 |
686 // Tick clock used by the network quality estimator. | 677 // Tick clock used by the network quality estimator. |
687 std::unique_ptr<base::TickClock> tick_clock_; | 678 std::unique_ptr<base::TickClock> tick_clock_; |
688 | 679 |
689 // Intervals after the main frame request arrives at which accuracy of network | 680 // Intervals after the main frame request arrives at which accuracy of network |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
792 // Last known value of the wireless signal strength. Set to INT32_MIN if | 783 // Last known value of the wireless signal strength. Set to INT32_MIN if |
793 // unavailable. |signal_strength_dbm_| is reset to INT32_MIN on connection | 784 // unavailable. |signal_strength_dbm_| is reset to INT32_MIN on connection |
794 // change events. | 785 // change events. |
795 int32_t signal_strength_dbm_; | 786 int32_t signal_strength_dbm_; |
796 | 787 |
797 // Minimum and maximum signal strength (in dBm) observed since last connection | 788 // Minimum and maximum signal strength (in dBm) observed since last connection |
798 // change. Updated on connection change and main frame requests. | 789 // change. Updated on connection change and main frame requests. |
799 int32_t min_signal_strength_since_connection_change_; | 790 int32_t min_signal_strength_since_connection_change_; |
800 int32_t max_signal_strength_since_connection_change_; | 791 int32_t max_signal_strength_since_connection_change_; |
801 | 792 |
802 // It is costlier to add values to a sparse histogram. So, the correlation UMA | |
803 // is recorded with |correlation_uma_logging_probability_| since recording it | |
804 // in a sparse histogram for each request is unnecessary and cost-prohibitive. | |
805 // e.g., if it is 0.0, then the UMA will never be recorded. On the other hand, | |
806 // if it is 1.0, then it will be recorded for all valid HTTP requests. | |
807 const double correlation_uma_logging_probability_; | |
808 | |
809 // Stores the qualities of different networks. | 793 // Stores the qualities of different networks. |
810 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; | 794 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; |
811 | 795 |
812 // True if effective connection type value has been forced via variation | |
813 // parameters. If set to true, GetEffectiveConnectionType() will always return | |
814 // |forced_effective_connection_type_|. | |
815 const bool forced_effective_connection_type_set_; | |
816 const EffectiveConnectionType forced_effective_connection_type_; | |
817 | |
818 // Set to true if reading of the network quality prefs is enabled. | 796 // Set to true if reading of the network quality prefs is enabled. |
819 const bool persistent_cache_reading_enabled_; | 797 const bool persistent_cache_reading_enabled_; |
RyanSturm
2017/05/03 17:41:02
move this too
tbansal1
2017/05/03 23:17:25
Done.
| |
820 | 798 |
821 base::ThreadChecker thread_checker_; | 799 base::ThreadChecker thread_checker_; |
822 | 800 |
823 // Manages the writing of events to the net log. | 801 // Manages the writing of events to the net log. |
824 nqe::internal::EventCreator event_creator_; | 802 nqe::internal::EventCreator event_creator_; |
825 | 803 |
826 // Vector that contains observation sources that should not be used when | 804 // Vector that contains observation sources that should not be used when |
827 // computing the estimate at HTTP layer. | 805 // computing the estimate at HTTP layer. |
828 const std::vector<NetworkQualityObservationSource> | 806 const std::vector<NetworkQualityObservationSource> |
829 disallowed_observation_sources_for_http_; | 807 disallowed_observation_sources_for_http_; |
830 | 808 |
831 // Vector that contains observation sources that should not be used when | 809 // Vector that contains observation sources that should not be used when |
832 // computing the estimate at transport layer. | 810 // computing the estimate at transport layer. |
833 const std::vector<NetworkQualityObservationSource> | 811 const std::vector<NetworkQualityObservationSource> |
834 disallowed_observation_sources_for_transport_; | 812 disallowed_observation_sources_for_transport_; |
835 | 813 |
836 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 814 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
837 | 815 |
838 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 816 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
839 }; | 817 }; |
840 | 818 |
841 } // namespace net | 819 } // namespace net |
842 | 820 |
843 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 821 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |