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

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

Issue 2032443003: NQE: Allow algorithm to be set using variation params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr comments Created 4 years, 6 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
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 const char* GetNameForEffectiveConnectionType( 310 const char* GetNameForEffectiveConnectionType(
311 EffectiveConnectionType type) const; 311 EffectiveConnectionType type) const;
312 312
313 // Overrides the tick clock used by |this| for testing. 313 // Overrides the tick clock used by |this| for testing.
314 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 314 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
315 315
316 private: 316 private:
317 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 317 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
318 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); 318 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation);
319 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); 319 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams);
320 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
321 ObtainAlgorithmToUseFromParams);
320 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); 322 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam);
321 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); 323 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles);
322 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); 324 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching);
323 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 325 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
324 TestLRUCacheMaximumSize); 326 TestLRUCacheMaximumSize);
325 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince); 327 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMetricsSince);
326 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 328 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
327 TestExternalEstimateProviderMergeEstimates); 329 TestExternalEstimateProviderMergeEstimates);
328 330
329 class SocketWatcher; 331 class SocketWatcher;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // Returns true only if the |request| can be used for RTT estimation. 434 // Returns true only if the |request| can be used for RTT estimation.
433 bool RequestProvidesRTTObservation(const URLRequest& request) const; 435 bool RequestProvidesRTTObservation(const URLRequest& request) const;
434 436
435 // Recomputes effective connection type, if it was computed more than the 437 // Recomputes effective connection type, if it was computed more than the
436 // specified duration ago, or if there has been a connection change recently. 438 // specified duration ago, or if there has been a connection change recently.
437 void MaybeRecomputeEffectiveConnectionType(); 439 void MaybeRecomputeEffectiveConnectionType();
438 440
439 // Notify observers of a change in effective connection type. 441 // Notify observers of a change in effective connection type.
440 void NotifyObserversOfEffectiveConnectionTypeChanged(); 442 void NotifyObserversOfEffectiveConnectionTypeChanged();
441 443
444 // Returns the effective type of the current connection based on only the
445 // samples observed after |start_time|. Uses HTTP RTT and downstream
446 // throughput to compute the effective connection type, and requires both of
447 // them to have a valid value.
448 EffectiveConnectionType
449 GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput(
450 const base::TimeTicks& start_time) const;
451
442 // Values of external estimate provider status. This enum must remain 452 // Values of external estimate provider status. This enum must remain
443 // synchronized with the enum of the same name in 453 // synchronized with the enum of the same name in
444 // metrics/histograms/histograms.xml. 454 // metrics/histograms/histograms.xml.
445 enum NQEExternalEstimateProviderStatus { 455 enum NQEExternalEstimateProviderStatus {
446 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, 456 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE,
447 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, 457 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE,
448 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, 458 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED,
449 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, 459 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL,
450 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, 460 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK,
451 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE, 461 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE,
(...skipping 10 matching lines...) Expand all
462 const bool use_localhost_requests_; 472 const bool use_localhost_requests_;
463 473
464 // Determines if the responses smaller than |kMinTransferSizeInBytes| 474 // Determines if the responses smaller than |kMinTransferSizeInBytes|
465 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the 475 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the
466 // network quality. Set to true only for tests. 476 // network quality. Set to true only for tests.
467 const bool use_small_responses_; 477 const bool use_small_responses_;
468 478
469 // The factor by which the weight of an observation reduces every second. 479 // The factor by which the weight of an observation reduces every second.
470 const double weight_multiplier_per_second_; 480 const double weight_multiplier_per_second_;
471 481
482 // Algorithm to use for computing effective connection type. The value is
483 // obtained from field trial parameters. If the value from field trial
484 // parameters is unavailable, it is set to
485 // |kDefaultEffectiveConnectionTypeAlgorithm|.
486 const std::string algorithm_;
487
472 // Tick clock used by the network quality estimator. 488 // Tick clock used by the network quality estimator.
473 std::unique_ptr<base::TickClock> tick_clock_; 489 std::unique_ptr<base::TickClock> tick_clock_;
474 490
475 // Minimum duration between two consecutive computations of effective 491 // Minimum duration between two consecutive computations of effective
476 // connection type. Set to non-zero value as a performance optimization. 492 // connection type. Set to non-zero value as a performance optimization.
477 const base::TimeDelta effective_connection_type_recomputation_interval_; 493 const base::TimeDelta effective_connection_type_recomputation_interval_;
478 494
479 // Time when the effective connection type was last computed. 495 // Time when the effective connection type was last computed.
480 base::TimeTicks last_effective_connection_type_computation_; 496 base::TimeTicks last_effective_connection_type_computation_;
481 497
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 base::ThreadChecker thread_checker_; 564 base::ThreadChecker thread_checker_;
549 565
550 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 566 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
551 567
552 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 568 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
553 }; 569 };
554 570
555 } // namespace net 571 } // namespace net
556 572
557 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 573 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | net/nqe/network_quality_estimator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698