Index: runtime/src/kmp_lock.cpp =================================================================== --- runtime/src/kmp_lock.cpp +++ runtime/src/kmp_lock.cpp @@ -3021,13 +3021,12 @@ // Time stamp counter #if KMP_ARCH_X86 || KMP_ARCH_X86_64 # define __kmp_tsc() __kmp_hardware_timestamp() -// Runtime's default backoff parameters -kmp_backoff_t __kmp_spin_backoff_params = { 1, 4096, 100 }; -#else -// Use nanoseconds for other platforms -extern kmp_uint64 __kmp_now_nsec(); -kmp_backoff_t __kmp_spin_backoff_params = { 1, 256, 100 }; +#elif KMP_OS_LINUX + // Use nanoseconds for other platforms + extern kmp_uint64 __kmp_now_nsec(); # define __kmp_tsc() __kmp_now_nsec() +#else +# error time stamp counter is not supported #endif // A useful predicate for dealing with timestamps that may wrap. @@ -3043,6 +3042,9 @@ return ((kmp_int64)b - (kmp_int64)a) > 0; } +// Runtime's default backoff parameters +kmp_backoff_t __kmp_spin_backoff_params = { 1, 4096, 100 }; + // Truncated binary exponential backoff function void __kmp_spin_backoff(kmp_backoff_t *boff) Index: runtime/src/z_Linux_util.c =================================================================== --- runtime/src/z_Linux_util.c +++ runtime/src/z_Linux_util.c @@ -2205,14 +2205,16 @@ *t = 1 / (double) CLOCKS_PER_SEC; } +#if KMP_OS_LINUX /* Return the current time stamp in nsec */ kmp_uint64 __kmp_now_nsec() { - struct timeval t; - gettimeofday(&t, NULL); - return KMP_NSEC_PER_SEC*t.tv_sec + 1000*t.tv_usec; + struct timespec t; + clock_gettime(CLOCK_MONOTONIC, &t); + return 1e9*t.tv_sec + t.tv_nsec; } +#endif /* Determine whether the given address is mapped into the current address space.