| 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 |
| 11 // data is uploaded to aggregate the test results, and this FieldTrial class | 11 // data is uploaded to aggregate the test results, and this FieldTrial class |
| 12 // manages the state of each such experiment (state == which option was | 12 // manages the state of each such experiment (state == which option was |
| 13 // pseudo-randomly selected). | 13 // pseudo-randomly selected). |
| 14 // | 14 // |
| 15 // States are typically generated randomly, either based on a one time | 15 // States are typically generated randomly, either based on a one time |
| 16 // randomization (which will yield the same results, in terms of selecting | 16 // randomization (which will yield the same results, in terms of selecting |
| 17 // the client for a field trial or not, for every run of the program on a | 17 // the client for a field trial or not, for every run of the program on a |
| 18 // given machine), or by a session randomization (generated each time the | 18 // given machine), or by a session randomization (generated each time the |
| 19 // application starts up, but held constant during the duration of the | 19 // application starts up, but held constant during the duration of the |
| 20 // process). | 20 // process). |
| 21 | 21 |
| 22 //------------------------------------------------------------------------------ | 22 //------------------------------------------------------------------------------ |
| 23 // Example: Suppose we have an experiment involving memory, such as determining | 23 // Example: Suppose we have an experiment involving memory, such as determining |
| 24 // the impact of some pruning algorithm. | 24 // the impact of some pruning algorithm. |
| 25 // We assume that we already have a histogram of memory usage, such as: | 25 // We assume that we already have a histogram of memory usage, such as: |
| 26 | 26 |
| 27 // HISTOGRAM_COUNTS("Memory.RendererTotal", count); | 27 // UMA_HISTOGRAM_COUNTS("Memory.RendererTotal", count); |
| 28 | 28 |
| 29 // Somewhere in main thread initialization code, we'd probably define an | 29 // Somewhere in main thread initialization code, we'd probably define an |
| 30 // instance of a FieldTrial, with code such as: | 30 // instance of a FieldTrial, with code such as: |
| 31 | 31 |
| 32 // // FieldTrials are reference counted, and persist automagically until | 32 // // FieldTrials are reference counted, and persist automagically until |
| 33 // // process teardown, courtesy of their automatic registration in | 33 // // process teardown, courtesy of their automatic registration in |
| 34 // // FieldTrialList. | 34 // // FieldTrialList. |
| 35 // // Note: This field trial will run in Chrome instances compiled through | 35 // // Note: This field trial will run in Chrome instances compiled through |
| 36 // // 8 July, 2015, and after that all instances will be in "StandardMem". | 36 // // 8 July, 2015, and after that all instances will be in "StandardMem". |
| 37 // scoped_refptr<base::FieldTrial> trial( | 37 // scoped_refptr<base::FieldTrial> trial( |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 478 |
| 479 // List of observers to be notified when a group is selected for a FieldTrial. | 479 // List of observers to be notified when a group is selected for a FieldTrial. |
| 480 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 480 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
| 481 | 481 |
| 482 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 482 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 483 }; | 483 }; |
| 484 | 484 |
| 485 } // namespace base | 485 } // namespace base |
| 486 | 486 |
| 487 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 487 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| OLD | NEW |