Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: net/nqe/network_quality_estimator.h

Issue 2221103003: Compute effective connection type dynamically (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() 280 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals()
281 const; 281 const;
282 282
283 // Overrides the tick clock used by |this| for testing. 283 // Overrides the tick clock used by |this| for testing.
284 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 284 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
285 285
286 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. 286 // Returns a random double in the range [0.0, 1.0). Virtualized for testing.
287 virtual double RandDouble() const; 287 virtual double RandDouble() const;
288 288
289 private: 289 private:
290 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
291 AdaptiveRecomputationEffectiveConnectionType);
290 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 292 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
291 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); 293 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation);
292 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); 294 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams);
293 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 295 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
294 ObtainAlgorithmToUseFromParams); 296 ObtainAlgorithmToUseFromParams);
295 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); 297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam);
296 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); 298 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles);
297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince); 299 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince);
298 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 300 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
299 TestExternalEstimateProviderMergeEstimates); 301 TestExternalEstimateProviderMergeEstimates);
302 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
303 UnknownEffectiveConnectionType);
300 304
301 // Value of round trip time observations is in base::TimeDelta. 305 // Value of round trip time observations is in base::TimeDelta.
302 typedef nqe::internal::Observation<base::TimeDelta> RttObservation; 306 typedef nqe::internal::Observation<base::TimeDelta> RttObservation;
303 typedef nqe::internal::ObservationBuffer<base::TimeDelta> 307 typedef nqe::internal::ObservationBuffer<base::TimeDelta>
304 RttObservationBuffer; 308 RttObservationBuffer;
305 309
306 // Value of throughput observations is in kilobits per second. 310 // Value of throughput observations is in kilobits per second.
307 typedef nqe::internal::Observation<int32_t> ThroughputObservation; 311 typedef nqe::internal::Observation<int32_t> ThroughputObservation;
308 typedef nqe::internal::ObservationBuffer<int32_t> ThroughputObservationBuffer; 312 typedef nqe::internal::ObservationBuffer<int32_t> ThroughputObservationBuffer;
309 313
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 497
494 // Algorithm to use for computing effective connection type. The value is 498 // Algorithm to use for computing effective connection type. The value is
495 // obtained from field trial parameters. If the value from field trial 499 // obtained from field trial parameters. If the value from field trial
496 // parameters is unavailable, it is set to 500 // parameters is unavailable, it is set to
497 // kDefaultEffectiveConnectionTypeAlgorithm. 501 // kDefaultEffectiveConnectionTypeAlgorithm.
498 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; 502 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_;
499 503
500 // Tick clock used by the network quality estimator. 504 // Tick clock used by the network quality estimator.
501 std::unique_ptr<base::TickClock> tick_clock_; 505 std::unique_ptr<base::TickClock> tick_clock_;
502 506
503 // Minimum duration between two consecutive computations of effective
504 // connection type. Set to non-zero value as a performance optimization.
505 const base::TimeDelta effective_connection_type_recomputation_interval_;
506
507 // Time when the effective connection type was last computed.
508 base::TimeTicks last_effective_connection_type_computation_;
509
510 // Intervals after the main frame request arrives at which accuracy of network 507 // Intervals after the main frame request arrives at which accuracy of network
511 // quality prediction is recorded. 508 // quality prediction is recorded.
512 std::vector<base::TimeDelta> accuracy_recording_intervals_; 509 std::vector<base::TimeDelta> accuracy_recording_intervals_;
513 510
514 // Time when last connection change was observed. 511 // Time when last connection change was observed.
515 base::TimeTicks last_connection_change_; 512 base::TimeTicks last_connection_change_;
516 513
517 // ID of the current network. 514 // ID of the current network.
518 nqe::internal::NetworkID current_network_id_; 515 nqe::internal::NetworkID current_network_id_;
519 516
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 base::ObserverList<ThroughputObserver> throughput_observer_list_; 573 base::ObserverList<ThroughputObserver> throughput_observer_list_;
577 574
578 std::unique_ptr<SocketPerformanceWatcherFactory> watcher_factory_; 575 std::unique_ptr<SocketPerformanceWatcherFactory> watcher_factory_;
579 576
580 // Takes throughput measurements, and passes them back to |this| through the 577 // Takes throughput measurements, and passes them back to |this| through the
581 // provided callback. |this| stores the throughput observations in 578 // provided callback. |this| stores the throughput observations in
582 // |downstream_throughput_kbps_observations_|, which are later used for 579 // |downstream_throughput_kbps_observations_|, which are later used for
583 // estimating the throughput. 580 // estimating the throughput.
584 std::unique_ptr<nqe::internal::ThroughputAnalyzer> throughput_analyzer_; 581 std::unique_ptr<nqe::internal::ThroughputAnalyzer> throughput_analyzer_;
585 582
583 // Minimum duration between two consecutive computations of effective
584 // connection type. Set to non-zero value as a performance optimization.
585 const base::TimeDelta effective_connection_type_recomputation_interval_;
586
587 // Time when the effective connection type was last computed.
588 base::TimeTicks last_effective_connection_type_computation_;
589
590 // Number of RTT and bandwidth samples available when effective connection
591 // type was last recomputed.
592 size_t rtt_observations_size_at_last_ect_computation_;
593 size_t throughput_observations_size_at_last_ect_computation_;
594
586 // Current effective connection type. It is updated on connection change 595 // Current effective connection type. It is updated on connection change
587 // events. It is also updated every time there is network traffic (provided 596 // events. It is also updated every time there is network traffic (provided
588 // the last computation was more than 597 // the last computation was more than
589 // |effective_connection_type_recomputation_interval_| ago). 598 // |effective_connection_type_recomputation_interval_| ago).
590 EffectiveConnectionType effective_connection_type_; 599 EffectiveConnectionType effective_connection_type_;
591 600
592 // Minimum and Maximum signal strength (in dbM) observed since last connection 601 // Minimum and Maximum signal strength (in dbM) observed since last connection
593 // change. Updated on connection change and main frame requests. 602 // change. Updated on connection change and main frame requests.
594 int32_t min_signal_strength_since_connection_change_; 603 int32_t min_signal_strength_since_connection_change_;
595 int32_t max_signal_strength_since_connection_change_; 604 int32_t max_signal_strength_since_connection_change_;
(...skipping 11 matching lines...) Expand all
607 base::ThreadChecker thread_checker_; 616 base::ThreadChecker thread_checker_;
608 617
609 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 618 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
610 619
611 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 620 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
612 }; 621 };
613 622
614 } // namespace net 623 } // namespace net
615 624
616 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 625 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698