diff options
Diffstat (limited to 'openmp/runtime/src/z_Linux_util.cpp')
-rw-r--r-- | openmp/runtime/src/z_Linux_util.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp index 56022e1..db69da2 100644 --- a/openmp/runtime/src/z_Linux_util.cpp +++ b/openmp/runtime/src/z_Linux_util.cpp @@ -93,6 +93,7 @@ static kmp_cond_align_t __kmp_wait_cv; static kmp_mutex_align_t __kmp_wait_mx; kmp_uint64 __kmp_ticks_per_msec = 1000000; +kmp_uint64 __kmp_ticks_per_usec = 1000; #ifdef DEBUG_SUSPEND static void __kmp_print_cond(char *buffer, kmp_cond_align_t *cond) { @@ -2002,7 +2003,7 @@ kmp_uint64 __kmp_now_nsec() { /* Measure clock ticks per millisecond */ void __kmp_initialize_system_tick() { kmp_uint64 now, nsec2, diff; - kmp_uint64 delay = 100000; // 50~100 usec on most machines. + kmp_uint64 delay = 1000000; // ~450 usec on most machines. kmp_uint64 nsec = __kmp_now_nsec(); kmp_uint64 goal = __kmp_hardware_timestamp() + delay; while ((now = __kmp_hardware_timestamp()) < goal) @@ -2010,9 +2011,11 @@ void __kmp_initialize_system_tick() { nsec2 = __kmp_now_nsec(); diff = nsec2 - nsec; if (diff > 0) { - kmp_uint64 tpms = ((kmp_uint64)1e6 * (delay + (now - goal)) / diff); - if (tpms > 0) - __kmp_ticks_per_msec = tpms; + double tpus = 1000.0 * (double)(delay + (now - goal)) / (double)diff; + if (tpus > 0.0) { + __kmp_ticks_per_msec = (kmp_uint64)(tpus * 1000.0); + __kmp_ticks_per_usec = (kmp_uint64)tpus; + } } } #endif |