summaryrefslogtreecommitdiffstats
path: root/base/cpu.h
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 03:27:50 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 03:27:50 +0000
commit949a88f5c96cbe5ab8b4494aaf980795731ec3d1 (patch)
treef651cae621d7a37f9910a739435c343b3f5bd175 /base/cpu.h
parentd0a01f18de2315d078336f1209f23b1c05fbebf6 (diff)
downloadchromium_src-949a88f5c96cbe5ab8b4494aaf980795731ec3d1.zip
chromium_src-949a88f5c96cbe5ab8b4494aaf980795731ec3d1.tar.gz
chromium_src-949a88f5c96cbe5ab8b4494aaf980795731ec3d1.tar.bz2
Create a class for getting at processor information via the
CPUID instruction. These will get used and integrated into the build in a future changelist. I debated on the naming of these. They are x86 processor specific. Suggestions on naming is welcome. Review URL: http://codereview.chromium.org/3199 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/cpu.h')
-rw-r--r--base/cpu.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/base/cpu.h b/base/cpu.h
new file mode 100644
index 0000000..e437a19
--- /dev/null
+++ b/base/cpu.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_CPU_H_
+#define BASE_CPU_H_
+
+#include <string>
+
+namespace base {
+
+// Query information about the processor.
+class CPU {
+ public:
+ // Constructor
+ CPU();
+
+ // Accessors for CPU information.
+ const std::string& vendor_name() const { return cpu_vendor_; }
+ int stepping() const { return stepping_; }
+ int model() const { return model_; }
+ int family() const { return family_; }
+ int type() const { return type_; }
+ int extended_model() const { return ext_model_; }
+ int extended_family() const { return ext_family_; }
+
+ private:
+ // Query the processor for CPUID information.
+ void Initialize();
+
+ int type_; // process type
+ int family_; // family of the processor
+ int model_; // model of processor
+ int stepping_; // processor revision number
+ int ext_model_;
+ int ext_family_;
+ std::string cpu_vendor_;
+};
+
+} // namespace base
+
+#endif // BASE_CPU_H_