| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Finds out if we're on a 2GB Parrot. | 100 // Finds out if we're on a 2GB Parrot. |
| 101 // | 101 // |
| 102 // This code reads and parses /etc/lsb-release. There are at least four other | 102 // This code reads and parses /etc/lsb-release. There are at least four other |
| 103 // places that open and parse /etc/lsb-release, and I wish I could fix the | 103 // places that open and parse /etc/lsb-release, and I wish I could fix the |
| 104 // mess. At least this code is temporary. | 104 // mess. At least this code is temporary. |
| 105 | 105 |
| 106 bool Is2GBParrot() { | 106 bool Is2GBParrot() { |
| 107 base::FilePath path("/etc/lsb-release"); | 107 base::FilePath path("/etc/lsb-release"); |
| 108 std::string contents; | 108 std::string contents; |
| 109 if (!file_util::ReadFileToString(path, &contents)) | 109 if (!base::ReadFileToString(path, &contents)) |
| 110 return false; | 110 return false; |
| 111 if (contents.find("CHROMEOS_RELEASE_BOARD=parrot") == std::string::npos) | 111 if (contents.find("CHROMEOS_RELEASE_BOARD=parrot") == std::string::npos) |
| 112 return false; | 112 return false; |
| 113 // There are 2GB and 4GB models. | 113 // There are 2GB and 4GB models. |
| 114 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; | 114 return base::SysInfo::AmountOfPhysicalMemory() <= 2LL * 1024 * 1024 * 1024; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Sets up field trial for measuring swap and CPU metrics after tab switch | 117 // Sets up field trial for measuring swap and CPU metrics after tab switch |
| 118 // and scroll events. crbug.com/253994 | 118 // and scroll events. crbug.com/253994 |
| 119 void SetupSwapJankFieldTrial() { | 119 void SetupSwapJankFieldTrial() { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 414 // Field trials that do not read from files can be initialized in | 414 // Field trials that do not read from files can be initialized in |
| 415 // ExternalMetrics::Start() above. | 415 // ExternalMetrics::Start() above. |
| 416 SetupProgressiveScanFieldTrial(); | 416 SetupProgressiveScanFieldTrial(); |
| 417 SetupSwapJankFieldTrial(); | 417 SetupSwapJankFieldTrial(); |
| 418 | 418 |
| 419 ScheduleCollector(); | 419 ScheduleCollector(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace chromeos | 422 } // namespace chromeos |
| OLD | NEW |