| OLD | NEW |
| 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 "chrome/browser/chromeos/external_metrics.h" | 5 #include "chrome/browser/chromeos/external_metrics.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) { | 90 if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) { |
| 91 LOG(INFO) << "Configured in group '" << trial->group_name() | 91 LOG(INFO) << "Configured in group '" << trial->group_name() |
| 92 << "' ('" << group_char << "') for " | 92 << "' ('" << group_char << "') for " |
| 93 << name_of_experiment << " field trial"; | 93 << name_of_experiment << " field trial"; |
| 94 } else { | 94 } else { |
| 95 LOG(ERROR) << "Couldn't write to " << group_file_path.value(); | 95 LOG(ERROR) << "Couldn't write to " << group_file_path.value(); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Finds out if we're on a 2GB Parrot. | 99 // Finds out if we're on a 2GB Parrot. |
| 100 // | |
| 101 // This code reads and parses /etc/lsb-release. There are at least four other | |
| 102 // places that open and parse /etc/lsb-release, and I wish I could fix the | |
| 103 // mess. At least this code is temporary. | |
| 104 | |
| 105 bool Is2GBParrot() { | 100 bool Is2GBParrot() { |
| 106 base::FilePath path("/etc/lsb-release"); | 101 if (base::SysInfo::GetLsbReleaseBoard() != "parrot") |
| 107 std::string contents; | |
| 108 if (!base::ReadFileToString(path, &contents)) | |
| 109 return false; | |
| 110 if (contents.find("CHROMEOS_RELEASE_BOARD=parrot") == std::string::npos) | |
| 111 return false; | 102 return false; |
| 112 // There are 2GB and 4GB models. | 103 // There are 2GB and 4GB models. |
| 113 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; | 104 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; |
| 114 } | 105 } |
| 115 | 106 |
| 116 // Sets up field trial for measuring swap and CPU metrics after tab switch | 107 // Sets up field trial for measuring swap and CPU metrics after tab switch |
| 117 // and scroll events. crbug.com/253994 | 108 // and scroll events. crbug.com/253994 |
| 118 void SetupSwapJankFieldTrial() { | 109 void SetupSwapJankFieldTrial() { |
| 119 const char name_of_experiment[] = "SwapJank64vs32Parrot"; | 110 const char name_of_experiment[] = "SwapJank64vs32Parrot"; |
| 120 | 111 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 403 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 413 // Field trials that do not read from files can be initialized in | 404 // Field trials that do not read from files can be initialized in |
| 414 // ExternalMetrics::Start() above. | 405 // ExternalMetrics::Start() above. |
| 415 SetupProgressiveScanFieldTrial(); | 406 SetupProgressiveScanFieldTrial(); |
| 416 SetupSwapJankFieldTrial(); | 407 SetupSwapJankFieldTrial(); |
| 417 | 408 |
| 418 ScheduleCollector(); | 409 ScheduleCollector(); |
| 419 } | 410 } |
| 420 | 411 |
| 421 } // namespace chromeos | 412 } // namespace chromeos |
| OLD | NEW |