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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // | 100 // |
101 // This code reads and parses /etc/lsb-release. There are at least four other | 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 | 102 // places that open and parse /etc/lsb-release, and I wish I could fix the |
103 // mess. At least this code is temporary. | 103 // mess. At least this code is temporary. |
Daniel Erat
2013/09/24 15:37:53
nit: delete this outdated comment
stevenjb
2013/09/24 17:18:34
Done.
| |
104 | 104 |
105 bool Is2GBParrot() { | 105 bool Is2GBParrot() { |
106 base::FilePath path("/etc/lsb-release"); | 106 if (base::SysInfo::GetLsbReleaseBoard() != "parrot") |
Daniel Erat
2013/09/24 15:37:53
this code makes me sad.
(probably not your fault.
stevenjb
2013/09/24 17:18:34
Yeah... at least we're not doing an extra file rea
| |
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; | 107 return false; |
112 // There are 2GB and 4GB models. | 108 // There are 2GB and 4GB models. |
113 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; | 109 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; |
114 } | 110 } |
115 | 111 |
116 // Sets up field trial for measuring swap and CPU metrics after tab switch | 112 // Sets up field trial for measuring swap and CPU metrics after tab switch |
117 // and scroll events. crbug.com/253994 | 113 // and scroll events. crbug.com/253994 |
118 void SetupSwapJankFieldTrial() { | 114 void SetupSwapJankFieldTrial() { |
119 const char name_of_experiment[] = "SwapJank64vs32Parrot"; | 115 const char name_of_experiment[] = "SwapJank64vs32Parrot"; |
120 | 116 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 408 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
413 // Field trials that do not read from files can be initialized in | 409 // Field trials that do not read from files can be initialized in |
414 // ExternalMetrics::Start() above. | 410 // ExternalMetrics::Start() above. |
415 SetupProgressiveScanFieldTrial(); | 411 SetupProgressiveScanFieldTrial(); |
416 SetupSwapJankFieldTrial(); | 412 SetupSwapJankFieldTrial(); |
417 | 413 |
418 ScheduleCollector(); | 414 ScheduleCollector(); |
419 } | 415 } |
420 | 416 |
421 } // namespace chromeos | 417 } // namespace chromeos |
OLD | NEW |