OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // FieldTrial is a class for handling details of statistical experiments | 5 // FieldTrial is a class for handling details of statistical experiments |
6 // performed by actual users in the field (i.e., in a shipped or beta product). | 6 // performed by actual users in the field (i.e., in a shipped or beta product). |
7 // All code is called exclusively on the UI thread currently. | 7 // All code is called exclusively on the UI thread currently. |
8 // | 8 // |
9 // The simplest example is an experiment to see whether one of two options | 9 // The simplest example is an experiment to see whether one of two options |
10 // produces "better" results across our user population. In that scenario, UMA | 10 // produces "better" results across our user population. In that scenario, UMA |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // officially chosen, otherwise name_group_id is left untouched and false | 139 // officially chosen, otherwise name_group_id is left untouched and false |
140 // is returned. When true is returned, the name and group ids were | 140 // is returned. When true is returned, the name and group ids were |
141 // successfully set in name_group_id. | 141 // successfully set in name_group_id. |
142 bool GetNameGroupId(NameGroupId* name_group_id); | 142 bool GetNameGroupId(NameGroupId* name_group_id); |
143 | 143 |
144 // Helper function for the most common use: as an argument to specify the | 144 // Helper function for the most common use: as an argument to specify the |
145 // name of a HISTOGRAM. Use the original histogram name as the name_prefix. | 145 // name of a HISTOGRAM. Use the original histogram name as the name_prefix. |
146 static std::string MakeName(const std::string& name_prefix, | 146 static std::string MakeName(const std::string& name_prefix, |
147 const std::string& trial_name); | 147 const std::string& trial_name); |
148 | 148 |
| 149 // Helper function to create a NameGroupId from |trial_name| and |group_name|. |
| 150 static NameGroupId MakeNameGroupId(const std::string& trial_name, |
| 151 const std::string& group_name); |
| 152 |
149 // Enable benchmarking sets field trials to a common setting. | 153 // Enable benchmarking sets field trials to a common setting. |
150 static void EnableBenchmarking(); | 154 static void EnableBenchmarking(); |
151 | 155 |
152 private: | 156 private: |
153 // Allow tests to access our innards for testing purposes. | 157 // Allow tests to access our innards for testing purposes. |
154 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Registration); | 158 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Registration); |
155 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, AbsoluteProbabilities); | 159 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, AbsoluteProbabilities); |
156 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, RemainingProbability); | 160 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, RemainingProbability); |
157 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FiftyFiftyProbability); | 161 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FiftyFiftyProbability); |
158 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, MiddleProbabilities); | 162 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, MiddleProbabilities); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 439 |
436 // List of observers to be notified when a group is selected for a FieldTrial. | 440 // List of observers to be notified when a group is selected for a FieldTrial. |
437 ObserverList<Observer> observer_list_; | 441 ObserverList<Observer> observer_list_; |
438 | 442 |
439 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 443 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
440 }; | 444 }; |
441 | 445 |
442 } // namespace base | 446 } // namespace base |
443 | 447 |
444 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 448 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |