From 163046cd23b2372c7fff71c7f5f06cf9abc8f092 Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 21 May 2019 23:48:30 -0400 Subject: [PATCH] P4 to Git Change 1785925 by skeely@skeely_LC_linux on 2019/05/21 23:23:32 SWDEV-190142 - Switch os::TimeNanos to use CLOCK_MONOTONIC_RAW. Avoids NTP adjustment and re-aligns CPU clock usage with ROCm. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#45 edit --- rocclr/runtime/os/os_posix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocclr/runtime/os/os_posix.cpp b/rocclr/runtime/os/os_posix.cpp index 9b7e33e317..7a9c33b269 100644 --- a/rocclr/runtime/os/os_posix.cpp +++ b/rocclr/runtime/os/os_posix.cpp @@ -429,7 +429,7 @@ void Os::yield() { ::sched_yield(); } uint64_t Os::timeNanos() { struct timespec tp; - ::clock_gettime(CLOCK_MONOTONIC, &tp); + ::clock_gettime(CLOCK_MONOTONIC_RAW, &tp); return (uint64_t)tp.tv_sec * (1000ULL * 1000ULL * 1000ULL) + (uint64_t)tp.tv_nsec; } @@ -437,7 +437,7 @@ uint64_t Os::timerResolutionNanos() { static uint64_t resolution = 0; if (resolution == 0) { struct timespec tp; - ::clock_getres(CLOCK_MONOTONIC, &tp); + ::clock_getres(CLOCK_MONOTONIC_RAW, &tp); resolution = (uint64_t)tp.tv_sec * (1000ULL * 1000ULL * 1000ULL) + (uint64_t)tp.tv_nsec; } return resolution;