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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 13993008: Remove the LowMemoryMargin field trial. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: clean up comment Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // subsystems. 777 // subsystems.
778 automatic_reboot_manager_.reset(); 778 automatic_reboot_manager_.reset();
779 779
780 // Clean up dependency on CrosSettings and stop pending data fetches. 780 // Clean up dependency on CrosSettings and stop pending data fetches.
781 KioskAppManager::Shutdown(); 781 KioskAppManager::Shutdown();
782 782
783 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); 783 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun();
784 } 784 }
785 785
786 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 786 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
787 SetupLowMemoryHeadroomFieldTrial();
788 SetupZramFieldTrial(); 787 SetupZramFieldTrial();
789 } 788 }
790 789
791 void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() {
792 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
793 // Only enable this experiment on Canary and Dev, since it's possible
794 // that this will make the machine unstable.
795 // Note that to have this code execute in a developer build,
796 // then chrome::VersionInfo::CHANNEL_UNKNOWN needs to be added here.
797 if (channel == chrome::VersionInfo::CHANNEL_CANARY ||
798 channel == chrome::VersionInfo::CHANNEL_DEV) {
799 const base::FieldTrial::Probability kDivisor = 7;
800 // 1 in 7 probability of being in each group. If the default value for the
801 // kernel matches one of the experiment groups, then they will have
802 // identical results.
803 const base::FieldTrial::Probability kEnableProbability = 1;
804 scoped_refptr<base::FieldTrial> trial =
805 base::FieldTrialList::FactoryGetFieldTrial(
806 "LowMemoryMargin", kDivisor, "default", 2012, 7, 30, NULL);
807 int disable = trial->AppendGroup("off", kEnableProbability);
808 int margin_0mb = trial->AppendGroup("0mb", kEnableProbability);
809 int margin_25mb = trial->AppendGroup("25mb", kEnableProbability);
810 int margin_50mb = trial->AppendGroup("50mb", kEnableProbability);
811 int margin_100mb = trial->AppendGroup("100mb", kEnableProbability);
812 int margin_200mb = trial->AppendGroup("200mb", kEnableProbability);
813 if (trial->group() == disable) {
814 LOG(WARNING) << "low_mem: Part of 'off' experiment";
815 LowMemoryObserver::SetLowMemoryMargin(-1);
816 } else if (trial->group() == margin_0mb) {
817 LOG(WARNING) << "low_mem: Part of '0MB' experiment";
818 LowMemoryObserver::SetLowMemoryMargin(0);
819 } else if (trial->group() == margin_25mb) {
820 LOG(WARNING) << "low_mem: Part of '25MB' experiment";
821 LowMemoryObserver::SetLowMemoryMargin(25);
822 } else if (trial->group() == margin_50mb) {
823 LOG(WARNING) << "low_mem: Part of '50MB' experiment";
824 LowMemoryObserver::SetLowMemoryMargin(50);
825 } else if (trial->group() == margin_100mb) {
826 LOG(WARNING) << "low_mem: Part of '100MB' experiment";
827 LowMemoryObserver::SetLowMemoryMargin(100);
828 } else if (trial->group() == margin_200mb) {
829 LOG(WARNING) << "low_mem: Part of '200MB' experiment";
830 LowMemoryObserver::SetLowMemoryMargin(200);
831 } else {
832 LOG(WARNING) << "low_mem: Part of 'default' experiment";
833 }
834 }
835 }
836
837
838 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { 790 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() {
839 // The dice for this experiment have been thrown at boot. The selected group 791 // The dice for this experiment have been thrown at boot. The selected group
840 // number is stored in a file. 792 // number is stored in a file.
841 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); 793 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled");
842 std::string zram_file_content; 794 std::string zram_file_content;
843 // If the file does not exist, the experiment has not started. 795 // If the file does not exist, the experiment has not started.
844 if (!file_util::ReadFileToString(kZramGroupPath, &zram_file_content)) 796 if (!file_util::ReadFileToString(kZramGroupPath, &zram_file_content))
845 return; 797 return;
846 // The file contains a single significant character, possibly followed by 798 // The file contains a single significant character, possibly followed by
847 // newline. "x" means the user has opted out. "0" through "8" are the valid 799 // newline. "x" means the user has opted out. "0" through "8" are the valid
(...skipping 25 matching lines...) Expand all
873 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); 825 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0);
874 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); 826 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0);
875 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); 827 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0);
876 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); 828 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0);
877 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); 829 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0);
878 // This is necessary to start the experiment as a side effect. 830 // This is necessary to start the experiment as a side effect.
879 trial->group(); 831 trial->group();
880 } 832 }
881 833
882 } // namespace chromeos 834 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.h ('k') | chrome/browser/chromeos/memory/oom_priority_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698