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

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 11823028: Use better group names for zram field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@zram2
Patch Set: Use better group names for zram field trial Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index cb8018cda1d91677d6120294d33e791592539b38..45b3146c4335007f45bd4599611d86e852ccb213 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -780,27 +780,29 @@ void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() {
// newline. "x" means the user has opted out. "0" through "8" are the valid
// group names. (See src/platform/init/swap-exp.conf in chromiumos repo for
// group meanings.)
- std::string zram_group = zram_file_content.substr(0, 1);
- if (zram_group.compare("x") == 0)
+ char zram_group = zram_file_content[0];
Alexei Svitkine (slow) 2013/01/09 19:00:36 Can you check that !zram_file_content.empty() some
Alexei Svitkine (slow) 2013/01/09 19:01:24 Sorry, I wrote this before you addressed James' co
+ if (zram_group == 'x')
return;
+ if (zram_group < '0' || zram_group > '8') {
+ LOG(WARNING) << "zram field trial: invalid group \"" << zram_group << "\"";
+ return;
+ }
+ LOG(WARNING) << "zram field trial: group " << zram_group;
Alexei Svitkine (slow) 2013/01/09 19:00:36 field_trial.cc has VLOGs that can tell you this al
Luigi Semenzato 2013/01/09 19:15:49 We discussed this in the previous review. That's
const base::FieldTrial::Probability kDivisor = 1; // on/off only
scoped_refptr<base::FieldTrial> trial =
base::FieldTrialList::FactoryGetFieldTrial(
"ZRAM", kDivisor, "default", 2013, 12, 31, NULL);
// Assign probability of 1 to the group Chrome OS has picked. Assign 0 to
// all other choices.
- const char* const kGroups[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8" };
- bool matched = false;
- for (size_t i = 0; i < arraysize(kGroups); ++i) {
- bool match = zram_group.compare(kGroups[i]) == 0;
- trial->AppendGroup(kGroups[i], match ? 1 : 0);
- if (match) {
- matched = true;
- LOG(WARNING) << "zram field trial: group " << kGroups[i];
- }
- }
- if (!matched)
- LOG(WARNING) << "zram field trial: invalid group \"" << zram_group << "\"";
+ trial->AppendGroup("2GB RAM, no swap", zram_group == '0' ? 1 : 0);
+ trial->AppendGroup("2GB RAM, 2GB swap", zram_group == '1' ? 1 : 0);
+ trial->AppendGroup("2GB RAM, 3GB swap", zram_group == '2' ? 1 : 0);
+ trial->AppendGroup("4GB RAM, no swap", zram_group == '3' ? 1 : 0);
+ trial->AppendGroup("4GB RAM, 4GB swap", zram_group == '4' ? 1 : 0);
+ trial->AppendGroup("4GB RAM, 6GB swap", zram_group == '5' ? 1 : 0);
+ trial->AppendGroup("snow, no swap", zram_group == '6' ? 1 : 0);
+ trial->AppendGroup("snow, 1GB swap", zram_group == '7' ? 1 : 0);
+ trial->AppendGroup("snow, 2GB swap", zram_group == '8' ? 1 : 0);
}
} // namespace chromeos
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698