summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/external_metrics.cc
diff options
context:
space:
mode:
authorwdg@chromium.org <wdg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 22:51:27 +0000
committerwdg@chromium.org <wdg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 22:51:27 +0000
commit50f2dd3144233a2d36d70f39ebf81275222e4a21 (patch)
tree4851ef854634ca28f2d62449c3cc37d11ddd1861 /chrome/browser/chromeos/external_metrics.cc
parent0533cc6d955e6ca3349aed8c1dda2f683ba81ff4 (diff)
downloadchromium_src-50f2dd3144233a2d36d70f39ebf81275222e4a21.zip
chromium_src-50f2dd3144233a2d36d70f39ebf81275222e4a21.tar.gz
chromium_src-50f2dd3144233a2d36d70f39ebf81275222e4a21.tar.bz2
shill (chromeos): Makes progressive scan finch experiment server-controlled
This experiment is should have been server-controlled instead of client-controlled. This CL effects that change. The finch study tests progressive scan versus full scan and, for progressive scan, tests different smaller scan sizes to determine which works best. R=stevet@chromium.org, mathp@chromium.org, stevenjb@chromium.org R=asvitkine@chromium.org BUG=chromium:242733 BUG=chromium:240456 TEST=manual. Review URL: https://chromiumcodereview.appspot.com/17913002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/external_metrics.cc')
-rw-r--r--chrome/browser/chromeos/external_metrics.cc48
1 files changed, 27 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc
index 16b4963..c8d6033 100644
--- a/chrome/browser/chromeos/external_metrics.cc
+++ b/chrome/browser/chromeos/external_metrics.cc
@@ -64,8 +64,7 @@ char GetFieldTrialGroupFromFile(const std::string& name_of_experiment,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
// The dice for this experiment have been thrown at boot. The selected group
// number is stored in a file.
- const base::FilePath kPathToGroupFile(
- FILE_PATH_LITERAL(path_to_group_file.c_str()));
+ const base::FilePath kPathToGroupFile(path_to_group_file);
std::string file_content;
// If the file does not exist, the experiment has not started.
@@ -165,32 +164,39 @@ void SetupProgressiveScanFieldTrial() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
const char name_of_experiment[] = "ProgressiveScan";
const char path_to_group_file[] = "/home/chronos/.progressive_scan_variation";
- char group_char = GetFieldTrialGroupFromFile(name_of_experiment,
- path_to_group_file);
- if (!IsGroupInFieldTrial(name_of_experiment, path_to_group_file, group_char,
- "c1234")) {
- return;
- }
-
- const base::FieldTrial::Probability kDivisor = 1; // on/off only.
+ const base::FieldTrial::Probability kDivisor = 1000;
scoped_refptr<base::FieldTrial> trial =
base::FieldTrialList::FactoryGetFieldTrial(name_of_experiment,
kDivisor,
- "default",
+ "Default",
2013, 12, 31, NULL);
- // Assign probability of 1 to the group Chrome OS has picked. Assign 0 to
- // all other choices.
- trial->AppendGroup("FullScan", group_char == 'c' ? kDivisor : 0);
- trial->AppendGroup("33Percent_4MinMax", group_char == '1' ? kDivisor : 0);
- trial->AppendGroup("50Percent_4MinMax", group_char == '2' ? kDivisor : 0);
- trial->AppendGroup("50Percent_8MinMax", group_char == '3' ? kDivisor : 0);
- trial->AppendGroup("100Percent_8MinMax", group_char == '4' ? kDivisor : 0);
+ // Announce the groups with 0 percentage; the actual percentages come from
+ // the server configuration.
+ std::map<int, std::string> group_to_char;
+ group_to_char[trial->AppendGroup("FullScan", 0)] = "c";
+ group_to_char[trial->AppendGroup("33Percent_4MinMax", 0)] = "1";
+ group_to_char[trial->AppendGroup("50Percent_4MinMax", 0)] = "2";
+ group_to_char[trial->AppendGroup("50Percent_8MinMax", 0)] = "3";
+ group_to_char[trial->AppendGroup("100Percent_8MinMax", 0)] = "4";
// Announce the experiment to any listeners (especially important is the UMA
// software, which will append the group names to UMA statistics).
- trial->group();
- LOG(INFO) << "Configured in group '" << trial->group_name() << "' for "
- << name_of_experiment << " field trial";
+ const int group_num = trial->group();
+ std::string group_char = "x";
+ if (ContainsKey(group_to_char, group_num))
+ group_char = group_to_char[group_num];
+
+ // Write the group to the file to be read by ChromeOS.
+ const base::FilePath kPathToGroupFile(path_to_group_file);
+
+ if (file_util::WriteFile(kPathToGroupFile, group_char.c_str(),
+ group_char.length())) {
+ LOG(INFO) << "Configured in group '" << trial->group_name()
+ << "' ('" << group_char << "') for "
+ << name_of_experiment << " field trial";
+ } else {
+ LOG(ERROR) << "Couldn't write to " << path_to_group_file;
+ }
}
} // namespace