summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_config.h.cmake6
-rw-r--r--openmp/runtime/src/kmp_stats_timing.h9
2 files changed, 15 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_config.h.cmake b/openmp/runtime/src/kmp_config.h.cmake
index e9d8fdf7739..9fe12b32edc 100644
--- a/openmp/runtime/src/kmp_config.h.cmake
+++ b/openmp/runtime/src/kmp_config.h.cmake
@@ -33,6 +33,12 @@
#define KMP_HAVE_PSAPI LIBOMP_HAVE_PSAPI
#cmakedefine01 LIBOMP_STATS
#define KMP_STATS_ENABLED LIBOMP_STATS
+#cmakedefine01 LIBOMP_HAVE_X86INTRIN_H
+#define KMP_HAVE_X86INTRIN_H LIBOMP_HAVE_X86INTRIN_H
+#cmakedefine01 LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
+#define KMP_HAVE___BUILTIN_READCYCLECOUNTER LIBOMP_HAVE___BUILTIN_READCYCLECOUNTER
+#cmakedefine01 LIBOMP_HAVE___RDTSC
+#define KMP_HAVE___RDTSC LIBOMP_HAVE___RDTSC
#cmakedefine01 LIBOMP_USE_DEBUGGER
#define USE_DEBUGGER LIBOMP_USE_DEBUGGER
#cmakedefine01 LIBOMP_OMPT_DEBUG
diff --git a/openmp/runtime/src/kmp_stats_timing.h b/openmp/runtime/src/kmp_stats_timing.h
index 83fb85bea32..b878bbd620d 100644
--- a/openmp/runtime/src/kmp_stats_timing.h
+++ b/openmp/runtime/src/kmp_stats_timing.h
@@ -21,6 +21,9 @@
#include <string>
#include <limits>
#include "kmp_os.h"
+#if KMP_HAVE_X86INTRIN_H
+# include <x86intrin.h>
+#endif
class tsc_tick_count {
private:
@@ -44,7 +47,13 @@ class tsc_tick_count {
const tsc_tick_count t1, const tsc_tick_count t0);
};
+#if KMP_HAVE___BUILTIN_READCYCLECOUNTER
+ tsc_tick_count() : my_count(static_cast<int64_t>(__builtin_readcyclecounter())) {}
+#elif KMP_HAVE___RDTSC
tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())) {};
+#else
+# error Must have high resolution timer defined
+#endif
tsc_tick_count(int64_t value) : my_count(value) {};
int64_t getValue() const { return my_count; }
tsc_tick_count later (tsc_tick_count const other) const {
OpenPOWER on IntegriCloud