• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Use the <code>system.cpu</code> API to query CPU metadata.
6namespace system.cpu {
7
8  // Counters for assessing CPU utilization.  Each field is monotonically
9  // increasing while the processor is powered on.  Values are in milliseconds.
10  dictionary CpuTime {
11    // The cumulative time used by userspace programs on this processor.
12    double user;
13
14    // The cumulative time used by kernel programs on this processor.
15    double kernel;
16
17    // The cumulative time spent idle by this processor.
18    double idle;
19
20    // The total cumulative time for this processor.  This value is equal to
21    // user + kernel + idle.
22    double total;
23  };
24
25  dictionary ProcessorInfo {
26    // Cumulative usage info for this logical processor.
27    CpuTime usage;
28  };
29
30  dictionary CpuInfo {
31    // The number of logical processors.
32    long numOfProcessors;
33
34    // The architecture name of the processors.
35    DOMString archName;
36
37    // The model name of the processors.
38    DOMString modelName;
39
40    // A set of feature codes indicating some of the processor's capabilities.
41    // The currently supported codes are "mmx", "sse", "sse2", "sse3", "ssse3",
42    // "sse4_1", "sse4_2", and "avx".
43    DOMString[] features;
44
45    // Information about each logical processor.
46    ProcessorInfo[] processors;
47  };
48
49  callback CpuInfoCallback = void (CpuInfo info);
50
51  interface Functions {
52    // Queries basic CPU information of the system.
53    static void getInfo(CpuInfoCallback callback);
54  };
55};
56