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

Side by Side Diff: base/metrics/field_trial.cc

Issue 10382018: Added a SetForced method to allow forcing a new set of group bucketting. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Initial Created 8 years, 7 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
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/metrics/field_trial_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include "base/build_time.h" 7 #include "base/build_time.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 big_string.append(1, kHistogramFieldTrialSeparator); 163 big_string.append(1, kHistogramFieldTrialSeparator);
164 return big_string.append(FieldTrialList::FindFullName(trial_name)); 164 return big_string.append(FieldTrialList::FindFullName(trial_name));
165 } 165 }
166 166
167 // static 167 // static
168 void FieldTrial::EnableBenchmarking() { 168 void FieldTrial::EnableBenchmarking() {
169 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount()); 169 DCHECK_EQ(0u, FieldTrialList::GetFieldTrialCount());
170 enable_benchmarking_ = true; 170 enable_benchmarking_ = true;
171 } 171 }
172 172
173 void FieldTrial::SetForced() {
174 DCHECK(!forced_);
175 // Explicit forcing should only be for cases where we dynamically want to
176 // change the bucketting into groups, so there must have been at least one
jar (doing other things) 2012/05/05 00:32:26 I'm not clear what "change the buketting into grou
MAD 2012/05/07 13:48:09 Done.
177 // non-default group appended.
178 DCHECK_GT(next_group_number_, kDefaultGroupNumber + 1);
179
180 // And we must finalize the group choice before we mark ourselves as forced.
181 group();
182 forced_ = true;
183 }
184
173 FieldTrial::~FieldTrial() {} 185 FieldTrial::~FieldTrial() {}
174 186
175 void FieldTrial::SetGroupChoice(const std::string& name, int number) { 187 void FieldTrial::SetGroupChoice(const std::string& name, int number) {
176 group_ = number; 188 group_ = number;
177 if (name.empty()) 189 if (name.empty())
178 StringAppendF(&group_name_, "%d", group_); 190 StringAppendF(&group_name_, "%d", group_);
179 else 191 else
180 group_name_ = name; 192 group_name_ = name;
181 } 193 }
182 194
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 used_without_global_ = true; 470 used_without_global_ = true;
459 return; 471 return;
460 } 472 }
461 AutoLock auto_lock(global_->lock_); 473 AutoLock auto_lock(global_->lock_);
462 DCHECK(!global_->PreLockedFind(trial->name())); 474 DCHECK(!global_->PreLockedFind(trial->name()));
463 trial->AddRef(); 475 trial->AddRef();
464 global_->registered_[trial->name()] = trial; 476 global_->registered_[trial->name()] = trial;
465 } 477 }
466 478
467 } // namespace base 479 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/metrics/field_trial_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698