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

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

Issue 2421063002: NQE: Separate out params to a different file (Closed)
Patch Set: Addressed bengr comments Created 4 years, 1 month 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 | « net/net.gypi ('k') | 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // TODO(tbansal): Consider using an autogenerated enum using macros. 427 // TODO(tbansal): Consider using an autogenerated enum using macros.
428 const std::map<std::string, EffectiveConnectionTypeAlgorithm> 428 const std::map<std::string, EffectiveConnectionTypeAlgorithm>
429 algorithm_name_to_enum_; 429 algorithm_name_to_enum_;
430 430
431 // The default algorithm to be used if the algorithm value is not available 431 // The default algorithm to be used if the algorithm value is not available
432 // through field trial parameters. 432 // through field trial parameters.
433 static const EffectiveConnectionTypeAlgorithm 433 static const EffectiveConnectionTypeAlgorithm
434 kDefaultEffectiveConnectionTypeAlgorithm = 434 kDefaultEffectiveConnectionTypeAlgorithm =
435 EffectiveConnectionTypeAlgorithm::HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT; 435 EffectiveConnectionTypeAlgorithm::HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT;
436 436
437 // Minimum valid value of the variation parameter that holds RTT (in
438 // milliseconds) values.
439 static const int kMinimumRTTVariationParameterMsec = 1;
440
441 // Minimum valid value of the variation parameter that holds throughput (in
442 // kilobits per second) values.
443 static const int kMinimumThroughputVariationParameterKbps = 1;
444
445 // Returns the RTT value to be used when the valid RTT is unavailable. Readers 437 // Returns the RTT value to be used when the valid RTT is unavailable. Readers
446 // should discard RTT if it is set to the value returned by |InvalidRTT()|. 438 // should discard RTT if it is set to the value returned by |InvalidRTT()|.
447 static const base::TimeDelta InvalidRTT(); 439 static const base::TimeDelta InvalidRTT();
448 440
449 // Queries external estimate provider for network quality. When the network 441 // Queries external estimate provider for network quality. When the network
450 // quality is available, OnUpdatedEstimateAvailable() is called. 442 // quality is available, OnUpdatedEstimateAvailable() is called.
451 void MaybeQueryExternalEstimateProvider() const; 443 void MaybeQueryExternalEstimateProvider() const;
452 444
453 // Records UMA when there is a change in connection type. 445 // Records UMA when there is a change in connection type.
454 void RecordMetricsOnConnectionTypeChanged() const; 446 void RecordMetricsOnConnectionTypeChanged() const;
455 447
456 // Records UMA on whether the NetworkID was available or not. Called right 448 // Records UMA on whether the NetworkID was available or not. Called right
457 // after a network change event. 449 // after a network change event.
458 void RecordNetworkIDAvailability() const; 450 void RecordNetworkIDAvailability() const;
459 451
460 // Records UMA on main frame requests. 452 // Records UMA on main frame requests.
461 void RecordMetricsOnMainFrameRequest() const; 453 void RecordMetricsOnMainFrameRequest() const;
462 454
463 // Records a downstream throughput observation to the observation buffer if 455 // Records a downstream throughput observation to the observation buffer if
464 // a valid observation is available. |downstream_kbps| is the downstream 456 // a valid observation is available. |downstream_kbps| is the downstream
465 // throughput in kilobits per second. 457 // throughput in kilobits per second.
466 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); 458 void OnNewThroughputObservationAvailable(int32_t downstream_kbps);
467 459
468 // Notifies |this| of a new transport layer RTT. 460 // Notifies |this| of a new transport layer RTT.
469 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol, 461 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol,
470 const base::TimeDelta& rtt); 462 const base::TimeDelta& rtt);
471 463
472 // Obtains operating parameters from the field trial parameters.
473 void ObtainOperatingParams(
474 const std::map<std::string, std::string>& variation_params);
475
476 // Obtains the model parameters for different effective connection types from 464 // Obtains the model parameters for different effective connection types from
477 // the field trial parameters. For each effective connection type, a model 465 // the field trial parameters. For each effective connection type, a model
478 // (currently composed of a RTT threshold and a downlink throughput threshold) 466 // (currently composed of a RTT threshold and a downlink throughput threshold)
479 // is provided by the field trial. 467 // is provided by the field trial.
480 void ObtainEffectiveConnectionTypeModelParams( 468 void ObtainOperatingParams(
481 const std::map<std::string, std::string>& variation_params); 469 const std::map<std::string, std::string>& variation_params);
482 470
483 // Adds the default median RTT and downstream throughput estimate for the 471 // Adds the default median RTT and downstream throughput estimate for the
484 // current connection type to the observation buffer. 472 // current connection type to the observation buffer.
485 void AddDefaultEstimates(); 473 void AddDefaultEstimates();
486 474
487 // Returns an estimate of network quality at the specified |percentile|. 475 // Returns an estimate of network quality at the specified |percentile|.
488 // |disallowed_observation_sources| is the list of observation sources that 476 // |disallowed_observation_sources| is the list of observation sources that
489 // should be excluded when computing the percentile. 477 // should be excluded when computing the percentile.
490 // Only the observations later than |start_time| are taken into account. 478 // Only the observations later than |start_time| are taken into account.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 // by timestamp. 617 // by timestamp.
630 ThroughputObservationBuffer downstream_throughput_kbps_observations_; 618 ThroughputObservationBuffer downstream_throughput_kbps_observations_;
631 619
632 // Buffer that holds RTT observations sorted by timestamp. 620 // Buffer that holds RTT observations sorted by timestamp.
633 RttObservationBuffer rtt_observations_; 621 RttObservationBuffer rtt_observations_;
634 622
635 // Default network quality observations obtained from the network quality 623 // Default network quality observations obtained from the network quality
636 // estimator field trial parameters. The observations are indexed by 624 // estimator field trial parameters. The observations are indexed by
637 // ConnectionType. 625 // ConnectionType.
638 nqe::internal::NetworkQuality 626 nqe::internal::NetworkQuality
639 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; 627 default_observations_[NetworkChangeNotifier::CONNECTION_LAST];
640
641 // Default thresholds for different effective connection types. The default
642 // values are used if the thresholds are unavailable from the variation
643 // params.
644 nqe::internal::NetworkQuality default_effective_connection_type_thresholds_
645 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
646 628
647 // Thresholds for different effective connection types obtained from field 629 // Thresholds for different effective connection types obtained from field
648 // trial variation params. These thresholds encode how different connection 630 // trial variation params. These thresholds encode how different connection
649 // types behave in general. In future, complex encodings (e.g., curve 631 // types behave in general. In future, complex encodings (e.g., curve
650 // fitting) may be used. 632 // fitting) may be used.
651 nqe::internal::NetworkQuality connection_thresholds_ 633 nqe::internal::NetworkQuality connection_thresholds_
652 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; 634 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
653 635
654 // Latest time when the headers for a main frame request were received. 636 // Latest time when the headers for a main frame request were received.
655 base::TimeTicks last_main_frame_request_; 637 base::TimeTicks last_main_frame_request_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 // if it is 1.0, then it will be recorded for all valid HTTP requests. 705 // if it is 1.0, then it will be recorded for all valid HTTP requests.
724 const double correlation_uma_logging_probability_; 706 const double correlation_uma_logging_probability_;
725 707
726 // Stores the qualities of different networks. 708 // Stores the qualities of different networks.
727 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; 709 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_;
728 710
729 // True if effective connection type value has been forced via variation 711 // True if effective connection type value has been forced via variation
730 // parameters. If set to true, GetEffectiveConnectionType() will always return 712 // parameters. If set to true, GetEffectiveConnectionType() will always return
731 // |forced_effective_connection_type_|. 713 // |forced_effective_connection_type_|.
732 const bool forced_effective_connection_type_set_; 714 const bool forced_effective_connection_type_set_;
733 EffectiveConnectionType forced_effective_connection_type_; 715 const EffectiveConnectionType forced_effective_connection_type_;
734 716
735 base::ThreadChecker thread_checker_; 717 base::ThreadChecker thread_checker_;
736 718
737 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 719 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
738 720
739 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 721 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
740 }; 722 };
741 723
742 } // namespace net 724 } // namespace net
743 725
744 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 726 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698