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

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

Issue 23588009: Parse /etc/lsb-release only once on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
104 104
105 bool Is2GBParrot() { 105 bool Is2GBParrot() {
106 base::FilePath path("/etc/lsb-release"); 106 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; 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698