From 68cfb95f0439efd5b9bdb875c4acb3271cd1ad00 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 25 Apr 2018 16:56:35 -0500 Subject: [PATCH] the timestamp to ns conversion correction Change-Id: I4928519dcef5850a9e43670d0e916e52ebf8cb0b [ROCm/rocprofiler commit: 0d286e5efa36016f871ef37dec0bd790a6531bbd] --- projects/rocprofiler/src/core/tracker.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/rocprofiler/src/core/tracker.h b/projects/rocprofiler/src/core/tracker.h index 170bf48eff..651dcd42ff 100644 --- a/projects/rocprofiler/src/core/tracker.h +++ b/projects/rocprofiler/src/core/tracker.h @@ -36,7 +36,7 @@ class Tracker { timestamp_t timestamp_hz = 0; hsa_status_t status = hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, ×tamp_hz); if (status != HSA_STATUS_SUCCESS) EXC_ABORT(status, "hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY)"); - timestamp_hz_ = (freq_t)timestamp_hz; + timestamp_factor_ = (freq_t)1000000000 / (freq_t)timestamp_hz; } ~Tracker() { mutex_.lock(); @@ -143,12 +143,12 @@ class Tracker { } inline timestamp_t timestamp2ns(const timestamp_t& timestamp) const { - const freq_t timestamp_sec = (freq_t)timestamp * 1000000000 / timestamp_hz_; - return (timestamp_t)timestamp_sec; + const freq_t timestamp_ns = (freq_t)timestamp * timestamp_factor_; + return (timestamp_t)timestamp_ns; } // Timestamp frequency - freq_t timestamp_hz_; + freq_t timestamp_factor_; // Timeout for wait on destruction timestamp_t timeout_; // Tracked signals list