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

Unified Diff: base/metrics/field_trial.h

Issue 6213001: disable field trials if the build is 30 days or older (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial.h
===================================================================
--- base/metrics/field_trial.h (revision 70854)
+++ base/metrics/field_trial.h (working copy)
@@ -94,6 +94,13 @@
// to the total_probability.
FieldTrial(const std::string& name, Probability total_probability);
+ // Determine if the field trial is to be disabled or not based on
+ // disable_duration_, build time of the module and Now(). This method sets
+ // disable_field_trail_ to true, if the difference between build time of the
+ // module and Now() is greater than disable_duration_. If disable_field_trail_
+ // is true then the field trial reverts to the 'default' bucket.
+ void FieldTrial::DetermineIfFieldTrailIsToBeDisabled();
+
// Establish the name and probability of the next group in this trial.
// Sometimes, based on construction randomization, this call may causes the
// provided group to be *THE* group selected for use in this instance.
@@ -112,6 +119,13 @@
// number is used as the group name.
std::string group_name() const { return group_name_; }
+ // Set the duration from build time of the module to disable Field Trial.
+ void SetDisableDuration(const base::TimeDelta& duration);
+
+ base::TimeDelta disableDuration() const {
+ return disable_duration_;
+ }
+
// Helper function for the most common use: as an argument to specifiy the
// name of a HISTOGRAM. Use the original histogram name as the name_prefix.
static std::string MakeName(const std::string& name_prefix,
@@ -120,6 +134,9 @@
// Enable benchmarking sets field trials to a common setting.
static void EnableBenchmarking();
+ // Get build time.
+ static Time GetBuildTime();
+
private:
friend class RefCounted<FieldTrial>;
@@ -143,6 +160,14 @@
int next_group_number_;
+ // The default value (all remaining probabilities) can be selected after the
+ // duration, which is based on the build time of the module.
+ base::TimeDelta disable_duration_;
+
+ // When disable_field_trail_ is true, field trial reverts to the 'default'
+ // bucket.
+ bool disable_field_trail_;
+
// The pseudo-randomly assigned group number.
// This is kNotParticipating if no group has been assigned.
int group_;
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698