[Openmp-commits] [openmp] r255907 - [STATS] replace __cpuid() intrinsic with already existing __kmp_x86_cpuid() function

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 17 08:58:26 PST 2015


Author: jlpeyton
Date: Thu Dec 17 10:58:26 2015
New Revision: 255907

URL: http://llvm.org/viewvc/llvm-project?rev=255907&view=rev
Log:
[STATS] replace __cpuid() intrinsic with already existing __kmp_x86_cpuid() function

Modified:
    openmp/trunk/runtime/src/kmp_stats_timing.cpp

Modified: openmp/trunk/runtime/src/kmp_stats_timing.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_stats_timing.cpp?rev=255907&r1=255906&r2=255907&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_stats_timing.cpp (original)
+++ openmp/trunk/runtime/src/kmp_stats_timing.cpp Thu Dec 17 10:58:26 2015
@@ -20,6 +20,7 @@
 #include <iomanip>
 #include <sstream>
 
+#include "kmp.h"
 #include "kmp_stats_timing.h"
 
 using namespace std;
@@ -40,15 +41,15 @@ double tsc_tick_count::tick_time()
 
     if (result == 0.0)
     {
-        int cpuinfo[4];
+        kmp_cpuid_t cpuinfo;
         char brand[256];
 
-        __cpuid(cpuinfo, 0x80000000);
+        __kmp_x86_cpuid(0x80000000, 0, &cpuinfo);
         memset(brand, 0, sizeof(brand));
-        int ids = cpuinfo[0];
+        int ids = cpuinfo.eax;
 
         for (unsigned int i=2; i<(ids^0x80000000)+2; i++)
-            __cpuid(brand+(i-2)*sizeof(cpuinfo), i | 0x80000000);
+            __kmp_x86_cpuid(i | 0x80000000, 0, (kmp_cpuid_t*)(brand+(i-2)*sizeof(kmp_cpuid_t)));
 
         char * start = &brand[0];
         for (;*start == ' '; start++)




More information about the Openmp-commits mailing list