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

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

Issue 2775223004: NQE: Make params a class (Closed)
Patch Set: ps Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PARAMS_H_ 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h"
12 #include "base/threading/thread_checker.h"
11 #include "net/base/network_change_notifier.h" 13 #include "net/base/network_change_notifier.h"
12 #include "net/nqe/effective_connection_type.h" 14 #include "net/nqe/effective_connection_type.h"
13 #include "net/nqe/network_quality.h" 15 #include "net/nqe/network_quality.h"
14 16
15 namespace net { 17 namespace net {
16 18
17 namespace nqe { 19 namespace nqe {
18 20
19 namespace internal { 21 namespace internal {
20 22
21 // Returns the algorithm that should be used for computing effective connection 23 class NetworkQualityEstimatorParams {
RyanSturm 2017/03/28 17:23:11 class comment.
tbansal1 2017/03/29 18:17:51 Done.
22 // type based on field trial params. Returns an empty string if a valid 24 public:
23 // algorithm paramter is not present in the field trial params. 25 explicit NetworkQualityEstimatorParams(
24 std::string GetEffectiveConnectionTypeAlgorithm( 26 const std::map<std::string, std::string>& params);
RyanSturm 2017/03/28 17:23:11 can you add a method comment to this constructor t
tbansal1 2017/03/29 18:17:51 Done.
25 const std::map<std::string, std::string>& variation_params);
26 27
27 // Computes and returns the weight multiplier per second, which represents the 28 ~NetworkQualityEstimatorParams();
28 // factor by which the weight of an observation reduces every second.
29 // |variation_params| is the map containing all field trial parameters
30 // related to the NetworkQualityualityEstimator field trial.
31 double GetWeightMultiplierPerSecond(
32 const std::map<std::string, std::string>& variation_params);
33 29
34 // Returns the factor by which the weight of an observation reduces for every 30 // Returns the algorithm that should be used for computing effective
RyanSturm 2017/03/28 17:23:11 A lot of these comments can remove the references
tbansal1 2017/03/29 18:17:51 Done.
35 // dBm difference between the current signal strength (in dBm), and the signal 31 // connection type based on field trial params. Returns an empty string if a
36 // strength at the time when the observation was taken. 32 // valid algorithm paramter is not present in the field trial params.
37 double GetWeightMultiplierPerDbm( 33 std::string GetEffectiveConnectionTypeAlgorithm() const;
38 const std::map<std::string, std::string>& variation_params);
39 34
40 // Returns a descriptive name corresponding to |connection_type|. 35 // Computes and returns the weight multiplier per second, which represents the
41 const char* GetNameForConnectionType( 36 // factor by which the weight of an observation reduces every second.
42 net::NetworkChangeNotifier::ConnectionType connection_type); 37 // |params| is the map containing all field trial parameters
38 // related to the NetworkQualityualityEstimator field trial.
39 double GetWeightMultiplierPerSecond() const;
43 40
44 // Sets the default observation for different connection types in 41 // Returns the factor by which the weight of an observation reduces for every
45 // |default_observations|. The default observations are different for different 42 // dBm difference between the current signal strength (in dBm), and the signal
46 // connection types (e.g., 2G, 3G, 4G, WiFi). The default observations may be 43 // strength at the time when the observation was taken.
47 // used to determine the network quality in absence of any other information. 44 double GetWeightMultiplierPerDbm() const;
48 void ObtainDefaultObservations(
49 const std::map<std::string, std::string>& variation_params,
50 nqe::internal::NetworkQuality default_observations[]);
51 45
52 // Sets |typical_network_quality| to typical network quality for different 46 // Returns a descriptive name corresponding to |connection_type|.
53 // effective connection types. 47 static const char* GetNameForConnectionType(
54 void ObtainTypicalNetworkQuality(NetworkQuality typical_network_quality[]); 48 net::NetworkChangeNotifier::ConnectionType connection_type);
55 49
56 // Parses the variation paramaters and sets the thresholds for different 50 // Sets the default observation for different connection types in
57 // effective connection types in |connection_thresholds|. 51 // |default_observations|. The default observations are different for
58 void ObtainEffectiveConnectionTypeModelParams( 52 // different connection types (e.g., 2G, 3G, 4G, WiFi). The default
59 const std::map<std::string, std::string>& variation_params, 53 // observations may be used to determine the network quality in absence of any
60 nqe::internal::NetworkQuality connection_thresholds[]); 54 // other information.
55 void ObtainDefaultObservations(
56 nqe::internal::NetworkQuality default_observations[]) const;
61 57
62 // Returns the fraction of URL requests that should record the correlation UMA. 58 // Sets |typical_network_quality| to typical network quality for different
63 double correlation_uma_logging_probability( 59 // effective connection types.
64 const std::map<std::string, std::string>& variation_params); 60 void ObtainTypicalNetworkQuality(
61 NetworkQuality typical_network_quality[]) const;
65 62
66 // Returns true if the effective connection type has been determined via 63 // Parses the variation paramaters and sets the thresholds for different
67 // variation parameters. 64 // effective connection types in |connection_thresholds|.
68 bool forced_effective_connection_type_set( 65 void ObtainEffectiveConnectionTypeModelParams(
69 const std::map<std::string, std::string>& variation_params); 66 nqe::internal::NetworkQuality connection_thresholds[]) const;
70 67
71 // Returns the effective connection type that was configured by variation 68 // Returns the fraction of URL requests that should record the correlation
72 // parameters. 69 // UMA.
73 EffectiveConnectionType forced_effective_connection_type( 70 double correlation_uma_logging_probability() const;
74 const std::map<std::string, std::string>& variation_params);
75 71
76 // Returns true if reading from the persistent cache has been enabled via field 72 // Returns true if the effective connection type has been determined via
77 // trial. 73 // variation parameters.
78 bool persistent_cache_reading_enabled( 74 bool forced_effective_connection_type_set() const;
79 const std::map<std::string, std::string>& variation_params);
80 75
81 // Returns the the minimum interval betweeen consecutive notifications to a 76 // Returns the effective connection type that was configured by variation
82 // single socket watcher. 77 // parameters.
83 base::TimeDelta GetMinSocketWatcherNotificationInterval( 78 EffectiveConnectionType forced_effective_connection_type() const;
84 const std::map<std::string, std::string>& variation_params); 79
80 // Returns true if reading from the persistent cache has been enabled via
81 // field trial.
82 bool persistent_cache_reading_enabled() const;
83
84 // Returns the the minimum interval betweeen consecutive notifications to a
85 // single socket watcher.
86 base::TimeDelta GetMinSocketWatcherNotificationInterval() const;
87
88 private:
89 const std::map<std::string, std::string> params_;
RyanSturm 2017/03/28 17:23:11 Add a comment to this.
tbansal1 2017/03/29 18:17:51 Done.
90
91 base::ThreadChecker thread_checker_;
92
93 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams);
94 };
85 95
86 } // namespace internal 96 } // namespace internal
87 97
88 } // namespace nqe 98 } // namespace nqe
89 99
90 } // namespace net 100 } // namespace net
91 101
92 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ 102 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698