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

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

Issue 2421063002: NQE: Separate out params to a different file (Closed)
Patch Set: ps Created 4 years, 2 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // TODO(tbansal): Consider using an autogenerated enum using macros. 413 // TODO(tbansal): Consider using an autogenerated enum using macros.
414 const std::map<std::string, EffectiveConnectionTypeAlgorithm> 414 const std::map<std::string, EffectiveConnectionTypeAlgorithm>
415 algorithm_name_to_enum_; 415 algorithm_name_to_enum_;
416 416
417 // The default algorithm to be used if the algorithm value is not available 417 // The default algorithm to be used if the algorithm value is not available
418 // through field trial parameters. 418 // through field trial parameters.
419 static const EffectiveConnectionTypeAlgorithm 419 static const EffectiveConnectionTypeAlgorithm
420 kDefaultEffectiveConnectionTypeAlgorithm = 420 kDefaultEffectiveConnectionTypeAlgorithm =
421 EffectiveConnectionTypeAlgorithm::HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT; 421 EffectiveConnectionTypeAlgorithm::HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT;
422 422
423 // Minimum valid value of the variation parameter that holds RTT (in
424 // milliseconds) values.
425 static const int kMinimumRTTVariationParameterMsec = 1;
426
427 // Minimum valid value of the variation parameter that holds throughput (in
428 // kilobits per second) values.
429 static const int kMinimumThroughputVariationParameterKbps = 1;
430
431 // Returns the RTT value to be used when the valid RTT is unavailable. Readers 423 // Returns the RTT value to be used when the valid RTT is unavailable. Readers
432 // should discard RTT if it is set to the value returned by |InvalidRTT()|. 424 // should discard RTT if it is set to the value returned by |InvalidRTT()|.
433 static const base::TimeDelta InvalidRTT(); 425 static const base::TimeDelta InvalidRTT();
434 426
435 // Queries external estimate provider for network quality. When the network 427 // Queries external estimate provider for network quality. When the network
436 // quality is available, OnUpdatedEstimateAvailable() is called. 428 // quality is available, OnUpdatedEstimateAvailable() is called.
437 void MaybeQueryExternalEstimateProvider() const; 429 void MaybeQueryExternalEstimateProvider() const;
438 430
439 // Records UMA when there is a change in connection type. 431 // Records UMA when there is a change in connection type.
440 void RecordMetricsOnConnectionTypeChanged() const; 432 void RecordMetricsOnConnectionTypeChanged() const;
441 433
442 // Records UMA on whether the NetworkID was available or not. Called right 434 // Records UMA on whether the NetworkID was available or not. Called right
443 // after a network change event. 435 // after a network change event.
444 void RecordNetworkIDAvailability() const; 436 void RecordNetworkIDAvailability() const;
445 437
446 // Records UMA on main frame requests. 438 // Records UMA on main frame requests.
447 void RecordMetricsOnMainFrameRequest() const; 439 void RecordMetricsOnMainFrameRequest() const;
448 440
449 // Records a downstream throughput observation to the observation buffer if 441 // Records a downstream throughput observation to the observation buffer if
450 // a valid observation is available. |downstream_kbps| is the downstream 442 // a valid observation is available. |downstream_kbps| is the downstream
451 // throughput in kilobits per second. 443 // throughput in kilobits per second.
452 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); 444 void OnNewThroughputObservationAvailable(int32_t downstream_kbps);
453 445
454 // Notifies |this| of a new transport layer RTT. 446 // Notifies |this| of a new transport layer RTT.
455 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol, 447 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol,
456 const base::TimeDelta& rtt); 448 const base::TimeDelta& rtt);
457 449
458 // Obtains operating parameters from the field trial parameters.
459 void ObtainOperatingParams(
460 const std::map<std::string, std::string>& variation_params);
461
462 // Obtains the model parameters for different effective connection types from 450 // Obtains the model parameters for different effective connection types from
463 // the field trial parameters. For each effective connection type, a model 451 // the field trial parameters. For each effective connection type, a model
464 // (currently composed of a RTT threshold and a downlink throughput threshold) 452 // (currently composed of a RTT threshold and a downlink throughput threshold)
465 // is provided by the field trial. 453 // is provided by the field trial.
466 void ObtainEffectiveConnectionTypeModelParams( 454 void ObtainOperatingParams(
467 const std::map<std::string, std::string>& variation_params); 455 const std::map<std::string, std::string>& variation_params);
468 456
469 // Adds the default median RTT and downstream throughput estimate for the 457 // Adds the default median RTT and downstream throughput estimate for the
470 // current connection type to the observation buffer. 458 // current connection type to the observation buffer.
471 void AddDefaultEstimates(); 459 void AddDefaultEstimates();
472 460
473 // Returns an estimate of network quality at the specified |percentile|. 461 // Returns an estimate of network quality at the specified |percentile|.
474 // |disallowed_observation_sources| is the list of observation sources that 462 // |disallowed_observation_sources| is the list of observation sources that
475 // should be excluded when computing the percentile. 463 // should be excluded when computing the percentile.
476 // Only the observations later than |start_time| are taken into account. 464 // Only the observations later than |start_time| are taken into account.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 605
618 // Buffer that holds RTT observations sorted by timestamp. 606 // Buffer that holds RTT observations sorted by timestamp.
619 RttObservationBuffer rtt_observations_; 607 RttObservationBuffer rtt_observations_;
620 608
621 // Default network quality observations obtained from the network quality 609 // Default network quality observations obtained from the network quality
622 // estimator field trial parameters. The observations are indexed by 610 // estimator field trial parameters. The observations are indexed by
623 // ConnectionType. 611 // ConnectionType.
624 nqe::internal::NetworkQuality 612 nqe::internal::NetworkQuality
625 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; 613 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1];
626 614
627 // Default thresholds for different effective connection types. The default
628 // values are used if the thresholds are unavailable from the variation
629 // params.
630 nqe::internal::NetworkQuality default_effective_connection_type_thresholds_
631 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
632
633 // Thresholds for different effective connection types obtained from field 615 // Thresholds for different effective connection types obtained from field
634 // trial variation params. These thresholds encode how different connection 616 // trial variation params. These thresholds encode how different connection
635 // types behave in general. In future, complex encodings (e.g., curve 617 // types behave in general. In future, complex encodings (e.g., curve
636 // fitting) may be used. 618 // fitting) may be used.
637 nqe::internal::NetworkQuality connection_thresholds_ 619 nqe::internal::NetworkQuality connection_thresholds_
638 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; 620 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
639 621
640 // Latest time when the headers for a main frame request were received. 622 // Latest time when the headers for a main frame request were received.
641 base::TimeTicks last_main_frame_request_; 623 base::TimeTicks last_main_frame_request_;
642 624
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // if it is 1.0, then it will be recorded for all valid HTTP requests. 691 // if it is 1.0, then it will be recorded for all valid HTTP requests.
710 const double correlation_uma_logging_probability_; 692 const double correlation_uma_logging_probability_;
711 693
712 // Stores the qualities of different networks. 694 // Stores the qualities of different networks.
713 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; 695 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_;
714 696
715 // True if effective connection type value has been forced via variation 697 // True if effective connection type value has been forced via variation
716 // parameters. If set to true, GetEffectiveConnectionType() will always return 698 // parameters. If set to true, GetEffectiveConnectionType() will always return
717 // |forced_effective_connection_type_|. 699 // |forced_effective_connection_type_|.
718 const bool forced_effective_connection_type_set_; 700 const bool forced_effective_connection_type_set_;
719 EffectiveConnectionType forced_effective_connection_type_; 701 const EffectiveConnectionType forced_effective_connection_type_;
720 702
721 base::ThreadChecker thread_checker_; 703 base::ThreadChecker thread_checker_;
722 704
723 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 705 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
724 706
725 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 707 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
726 }; 708 };
727 709
728 } // namespace net 710 } // namespace net
729 711
730 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 712 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698