| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 void RecordNetworkIDAvailability() const; | 530 void RecordNetworkIDAvailability() const; |
| 531 | 531 |
| 532 // Records UMA on main frame requests. | 532 // Records UMA on main frame requests. |
| 533 void RecordMetricsOnMainFrameRequest() const; | 533 void RecordMetricsOnMainFrameRequest() const; |
| 534 | 534 |
| 535 // Records a downstream throughput observation to the observation buffer if | 535 // Records a downstream throughput observation to the observation buffer if |
| 536 // a valid observation is available. |downstream_kbps| is the downstream | 536 // a valid observation is available. |downstream_kbps| is the downstream |
| 537 // throughput in kilobits per second. | 537 // throughput in kilobits per second. |
| 538 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); | 538 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); |
| 539 | 539 |
| 540 // Obtains the model parameters for different effective connection types from | |
| 541 // the field trial parameters. For each effective connection type, a model | |
| 542 // (currently composed of a RTT threshold and a downlink throughput threshold) | |
| 543 // is provided by the field trial. | |
| 544 void ObtainOperatingParams(); | |
| 545 | |
| 546 // Adds the default median RTT and downstream throughput estimate for the | 540 // Adds the default median RTT and downstream throughput estimate for the |
| 547 // current connection type to the observation buffer. | 541 // current connection type to the observation buffer. |
| 548 void AddDefaultEstimates(); | 542 void AddDefaultEstimates(); |
| 549 | 543 |
| 550 // Returns the current network ID checking by calling the platform APIs. | 544 // Returns the current network ID checking by calling the platform APIs. |
| 551 // Virtualized for testing. | 545 // Virtualized for testing. |
| 552 virtual nqe::internal::NetworkID GetCurrentNetworkID() const; | 546 virtual nqe::internal::NetworkID GetCurrentNetworkID() const; |
| 553 | 547 |
| 554 // Notifies RTT observers of |observation|. May also trigger recomputation | 548 // Notifies RTT observers of |observation|. May also trigger recomputation |
| 555 // of effective connection type. | 549 // of effective connection type. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 // 2) Includes server processing time. | 694 // 2) Includes server processing time. |
| 701 nqe::internal::NetworkQuality peak_network_quality_; | 695 nqe::internal::NetworkQuality peak_network_quality_; |
| 702 | 696 |
| 703 // Buffer that holds throughput observations (in kilobits per second) sorted | 697 // Buffer that holds throughput observations (in kilobits per second) sorted |
| 704 // by timestamp. | 698 // by timestamp. |
| 705 ThroughputObservationBuffer downstream_throughput_kbps_observations_; | 699 ThroughputObservationBuffer downstream_throughput_kbps_observations_; |
| 706 | 700 |
| 707 // Buffer that holds RTT observations sorted by timestamp. | 701 // Buffer that holds RTT observations sorted by timestamp. |
| 708 RttObservationBuffer rtt_observations_; | 702 RttObservationBuffer rtt_observations_; |
| 709 | 703 |
| 710 // Default network quality observations obtained from the network quality | |
| 711 // estimator field trial parameters. The observations are indexed by | |
| 712 // ConnectionType. | |
| 713 nqe::internal::NetworkQuality | |
| 714 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; | |
| 715 | |
| 716 // Thresholds for different effective connection types obtained from field | |
| 717 // trial variation params. These thresholds encode how different connection | |
| 718 // types behave in general. In future, complex encodings (e.g., curve | |
| 719 // fitting) may be used. | |
| 720 nqe::internal::NetworkQuality connection_thresholds_ | |
| 721 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; | |
| 722 | |
| 723 // Typical network quality for different effective connection types. | |
| 724 nqe::internal::NetworkQuality typical_network_quality_ | |
| 725 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; | |
| 726 | |
| 727 // Time when the transaction for the last main frame request was started. | 704 // Time when the transaction for the last main frame request was started. |
| 728 base::TimeTicks last_main_frame_request_; | 705 base::TimeTicks last_main_frame_request_; |
| 729 | 706 |
| 730 // Estimated network quality when the transaction for the last main frame | 707 // Estimated network quality when the transaction for the last main frame |
| 731 // request was started. | 708 // request was started. |
| 732 nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_; | 709 nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_; |
| 733 EffectiveConnectionType effective_connection_type_at_last_main_frame_; | 710 EffectiveConnectionType effective_connection_type_at_last_main_frame_; |
| 734 | 711 |
| 735 // Estimated RTT at HTTP layer when the last main frame transaction was | 712 // Estimated RTT at HTTP layer when the last main frame transaction was |
| 736 // started. Computed using different statistics. | 713 // started. Computed using different statistics. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 disallowed_observation_sources_for_transport_; | 787 disallowed_observation_sources_for_transport_; |
| 811 | 788 |
| 812 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 789 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 813 | 790 |
| 814 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 791 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 815 }; | 792 }; |
| 816 | 793 |
| 817 } // namespace net | 794 } // namespace net |
| 818 | 795 |
| 819 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 796 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |