OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2011 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 #ifndef BASE_CPU_H_ | 5 #ifndef BASE_CPU_H_ |
6 #define BASE_CPU_H_ | 6 #define BASE_CPU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "build/build_config.h" |
| 10 |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 namespace base { | 13 namespace base { |
12 | 14 |
13 // Query information about the processor. | 15 // Query information about the processor. |
14 class CPU { | 16 class CPU { |
15 public: | 17 public: |
16 // Constructor | 18 // Constructor |
17 CPU(); | 19 CPU(); |
18 | 20 |
19 // Accessors for CPU information. | 21 // Accessors for CPU information. |
20 const std::string& vendor_name() const { return cpu_vendor_; } | 22 const std::string& vendor_name() const { return cpu_vendor_; } |
21 int stepping() const { return stepping_; } | 23 int stepping() const { return stepping_; } |
22 int model() const { return model_; } | 24 int model() const { return model_; } |
23 int family() const { return family_; } | 25 int family() const { return family_; } |
24 int type() const { return type_; } | 26 int type() const { return type_; } |
25 int extended_model() const { return ext_model_; } | 27 int extended_model() const { return ext_model_; } |
26 int extended_family() const { return ext_family_; } | 28 int extended_family() const { return ext_family_; } |
| 29 int has_mmx() const { return has_mmx_; } |
| 30 int has_sse() const { return has_sse_; } |
| 31 int has_sse2() const { return has_sse2_; } |
| 32 int has_sse3() const { return has_sse3_; } |
| 33 int has_ssse3() const { return has_ssse3_; } |
| 34 int has_sse41() const { return has_sse41_; } |
| 35 int has_sse42() const { return has_sse42_; } |
27 | 36 |
28 private: | 37 private: |
29 // Query the processor for CPUID information. | 38 // Query the processor for CPUID information. |
30 void Initialize(); | 39 void Initialize(); |
31 | 40 |
32 int type_; // process type | 41 int type_; // process type |
33 int family_; // family of the processor | 42 int family_; // family of the processor |
34 int model_; // model of processor | 43 int model_; // model of processor |
35 int stepping_; // processor revision number | 44 int stepping_; // processor revision number |
36 int ext_model_; | 45 int ext_model_; |
37 int ext_family_; | 46 int ext_family_; |
| 47 bool has_mmx_; |
| 48 bool has_sse_; |
| 49 bool has_sse2_; |
| 50 bool has_sse3_; |
| 51 bool has_ssse3_; |
| 52 bool has_sse41_; |
| 53 bool has_sse42_; |
38 std::string cpu_vendor_; | 54 std::string cpu_vendor_; |
39 }; | 55 }; |
40 | 56 |
41 } // namespace base | 57 } // namespace base |
42 | 58 |
43 #endif // BASE_CPU_H_ | 59 #endif // BASE_CPU_H_ |
OLD | NEW |