|
1 // Copyright (c) 2006-2008 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 #ifndef BASE_CPU_H_ |
|
6 #define BASE_CPU_H_ |
|
7 |
|
8 #include <string> |
|
9 |
|
10 namespace base { |
|
11 |
|
12 // Query information about the processor. |
|
13 class CPU { |
|
14 public: |
|
15 // Constructor |
|
16 CPU(); |
|
17 |
|
18 // Accessors for CPU information. |
|
19 const std::string& vendor_name() const { return cpu_vendor_; } |
|
20 int stepping() const { return stepping_; } |
|
21 int model() const { return model_; } |
|
22 int family() const { return family_; } |
|
23 int type() const { return type_; } |
|
24 int extended_model() const { return ext_model_; } |
|
25 int extended_family() const { return ext_family_; } |
|
26 |
|
27 private: |
|
28 // Query the processor for CPUID information. |
|
29 void Initialize(); |
|
30 |
|
31 int type_; // process type |
|
32 int family_; // family of the processor |
|
33 int model_; // model of processor |
|
34 int stepping_; // processor revision number |
|
35 int ext_model_; |
|
36 int ext_family_; |
|
37 std::string cpu_vendor_; |
|
38 }; |
|
39 |
|
40 } // namespace base |
|
41 |
|
42 #endif // BASE_CPU_H_ |