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

Unified Diff: base/cpu.cc

Issue 13583007: Create a field trial to test if we can detect good QPC implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/cpu.cc
diff --git a/base/cpu.cc b/base/cpu.cc
index d6976bab33b316aed50e3a133edf1a7e8a060a97..0f07ef674d4ae81eb63902982393b5dc7ef58490 100644
--- a/base/cpu.cc
+++ b/base/cpu.cc
@@ -32,6 +32,7 @@ CPU::CPU()
has_ssse3_(false),
has_sse41_(false),
has_sse42_(false),
+ has_nonstoptsc_(false),
cpu_vendor_("unknown") {
Initialize();
}
@@ -123,6 +124,7 @@ void CPU::Initialize() {
// Get the brand string of the cpu.
__cpuid(cpu_info, 0x80000000);
const int parameter_end = 0x80000004;
+ int max_parameter = cpu_info[0];
if (cpu_info[0] >= parameter_end) {
char* cpu_string_ptr = cpu_string;
@@ -135,6 +137,12 @@ void CPU::Initialize() {
}
cpu_brand_.assign(cpu_string, cpu_string_ptr - cpu_string);
}
+
+ const int parameter_containing_nonstoptsc = 0x80000007;
+ if (max_parameter >= parameter_containing_nonstoptsc) {
+ __cpuid(cpu_info, parameter_containing_nonstoptsc);
+ has_nonstoptsc_ = (cpu_info[3] & (1 << 8)) != 0;
jar (doing other things) 2013/04/04 00:26:13 nit: unless there is a great reason to write this
James Simonsen 2013/04/04 02:26:51 Done.
+ }
#endif
}

Powered by Google App Engine
This is Rietveld 408576698