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

Side by Side Diff: extensions/browser/api/system_cpu/cpu_info_provider_linux.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/system_cpu/cpu_info_provider.h" 5 #include "extensions/browser/api/system_cpu/cpu_info_provider.h"
6 6
7 #include <cstdio> 7 #include <cstdio>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 namespace { 15 namespace {
16 16
17 const char kProcStat[] = "/proc/stat"; 17 const char kProcStat[] = "/proc/stat";
18 18
19 } // namespace 19 } // namespace
20 20
21 bool CpuInfoProvider::QueryCpuTimePerProcessor( 21 bool CpuInfoProvider::QueryCpuTimePerProcessor(
22 std::vector<linked_ptr<core_api::system_cpu::ProcessorInfo> >* infos) { 22 std::vector<linked_ptr<api::system_cpu::ProcessorInfo>>* infos) {
23 DCHECK(infos); 23 DCHECK(infos);
24 24
25 // WARNING: this method may return incomplete data because some processors may 25 // WARNING: this method may return incomplete data because some processors may
26 // be brought offline at runtime. /proc/stat does not report statistics of 26 // be brought offline at runtime. /proc/stat does not report statistics of
27 // offline processors. CPU usages of offline processors will be filled with 27 // offline processors. CPU usages of offline processors will be filled with
28 // zeros. 28 // zeros.
29 // 29 //
30 // An example of output of /proc/stat when processor 0 and 3 are online, but 30 // An example of output of /proc/stat when processor 0 and 3 are online, but
31 // processor 1 and 2 are offline: 31 // processor 1 and 2 are offline:
32 // 32 //
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 infos->at(pindex)->usage.user = static_cast<double>(user + nice); 66 infos->at(pindex)->usage.user = static_cast<double>(user + nice);
67 infos->at(pindex)->usage.idle = static_cast<double>(idle); 67 infos->at(pindex)->usage.idle = static_cast<double>(idle);
68 infos->at(pindex)->usage.total = 68 infos->at(pindex)->usage.total =
69 static_cast<double>(sys + user + nice + idle); 69 static_cast<double>(sys + user + nice + idle);
70 } 70 }
71 71
72 return true; 72 return true;
73 } 73 }
74 74
75 } // namespace extensions 75 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_cpu/cpu_info_provider.cc ('k') | extensions/browser/api/system_cpu/cpu_info_provider_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698