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 20 matching lines...) Expand all Loading... |
31 // Somewhere in main thread initialization code, we'd probably define an | 31 // Somewhere in main thread initialization code, we'd probably define an |
32 // instance of a FieldTrial, with code such as: | 32 // instance of a FieldTrial, with code such as: |
33 | 33 |
34 // // FieldTrials are reference counted, and persist automagically until | 34 // // FieldTrials are reference counted, and persist automagically until |
35 // // process teardown, courtesy of their automatic registration in | 35 // // process teardown, courtesy of their automatic registration in |
36 // // FieldTrialList. | 36 // // FieldTrialList. |
37 // // Note: This field trial will run in Chrome instances compiled through | 37 // // Note: This field trial will run in Chrome instances compiled through |
38 // // 8 July, 2015, and after that all instances will be in "StandardMem". | 38 // // 8 July, 2015, and after that all instances will be in "StandardMem". |
39 // scoped_refptr<base::FieldTrial> trial( | 39 // scoped_refptr<base::FieldTrial> trial( |
40 // base::FieldTrialList::FactoryGetFieldTrial("MemoryExperiment", 1000, | 40 // base::FieldTrialList::FactoryGetFieldTrial("MemoryExperiment", 1000, |
41 // "StandardMem", 2015, 7, 8)); | 41 // "StandardMem", 2015, 7, 8, |
42 // const int kHighMemGroup = | 42 // NULL)); |
| 43 // const int high_mem_group = |
43 // trial->AppendGroup("HighMem", 20); // 2% in HighMem group. | 44 // trial->AppendGroup("HighMem", 20); // 2% in HighMem group. |
44 // const int kLowMemGroup = | 45 // const int low_mem_group = |
45 // trial->AppendGroup("LowMem", 20); // 2% in LowMem group. | 46 // trial->AppendGroup("LowMem", 20); // 2% in LowMem group. |
46 // // Take action depending of which group we randomly land in. | 47 // // Take action depending of which group we randomly land in. |
47 // if (trial->group() == kHighMemGroup) | 48 // if (trial->group() == high_mem_group) |
48 // SetPruningAlgorithm(kType1); // Sample setting of browser state. | 49 // SetPruningAlgorithm(kType1); // Sample setting of browser state. |
49 // else if (trial->group() == kLowMemGroup) | 50 // else if (trial->group() == low_mem_group) |
50 // SetPruningAlgorithm(kType2); // Sample alternate setting. | 51 // SetPruningAlgorithm(kType2); // Sample alternate setting. |
51 | 52 |
52 // We then, in addition to our original histogram, output histograms which have | 53 // We then, in addition to our original histogram, output histograms which have |
53 // slightly different names depending on what group the trial instance happened | 54 // slightly different names depending on what group the trial instance happened |
54 // to randomly be assigned: | 55 // to randomly be assigned: |
55 | 56 |
56 // HISTOGRAM_COUNTS("Memory.RendererTotal", count); // The original histogram. | 57 // HISTOGRAM_COUNTS("Memory.RendererTotal", count); // The original histogram. |
57 // static const bool memory_renderer_total_trial_exists = | 58 // static const bool memory_renderer_total_trial_exists = |
58 // FieldTrialList::TrialExists("MemoryExperiment"); | 59 // FieldTrialList::TrialExists("MemoryExperiment"); |
59 // if (memory_renderer_total_trial_exists) { | 60 // if (memory_renderer_total_trial_exists) { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 435 |
435 // List of observers to be notified when a group is selected for a FieldTrial. | 436 // List of observers to be notified when a group is selected for a FieldTrial. |
436 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 437 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
437 | 438 |
438 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 439 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
439 }; | 440 }; |
440 | 441 |
441 } // namespace base | 442 } // namespace base |
442 | 443 |
443 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 444 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |