Index: base/cpu.cc |
=================================================================== |
--- base/cpu.cc (revision 159378) |
+++ base/cpu.cc (working copy) |
@@ -85,6 +85,7 @@ |
#if defined(ARCH_CPU_X86_FAMILY) |
int cpu_info[4] = {-1}; |
char cpu_string[0x20]; |
+ char cpu_brand[0x30]; |
// __cpuid with an InfoType argument of 0 returns the number of |
// valid Ids in CPUInfo[0] and the CPU identification string in |
@@ -118,6 +119,23 @@ |
has_ssse3_ = (cpu_info[2] & 0x00000200) != 0; |
has_sse41_ = (cpu_info[2] & 0x00080000) != 0; |
has_sse42_ = (cpu_info[2] & 0x00100000) != 0; |
+ |
+ //get the brand string of the cpu. |
Zhenyao Mo
2012/10/01 19:04:33
one space after //
|
+ __cpuid(cpu_info, 0x80000000); |
+ |
+ if (cpu_info[0] >= 0x80000004) { |
+ memset(cpu_brand, 0, sizeof(cpu_brand)); |
+ int start_flag = 0x80000002; |
+ |
+ for (int index = 0; index < 3; index++) { |
+ __cpuid(cpu_info, start_flag + index); |
+ *(reinterpret_cast<int*>(cpu_brand + index*16)) = cpu_info[0]; |
+ *(reinterpret_cast<int*>(cpu_brand + index*16 + 4)) = cpu_info[1]; |
+ *(reinterpret_cast<int*>(cpu_brand + index*16 + 8)) = cpu_info[2]; |
+ *(reinterpret_cast<int*>(cpu_brand + index*16 + 12)) = cpu_info[3]; |
+ } |
+ cpu_brand_ = cpu_brand; |
+ } |
} |
#endif |
} |