From 7e1622083eb0ca856ef629e4a9bb31a630c49fed Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 19 Jun 2021 13:40:31 +0200 Subject: [PATCH] Use monotonic raw clock for hardware sampling. --- client/TracySysTrace.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/TracySysTrace.cpp b/client/TracySysTrace.cpp index 95a5208c..5272f1fc 100644 --- a/client/TracySysTrace.cpp +++ b/client/TracySysTrace.cpp @@ -831,6 +831,11 @@ static void SetupSampling( int64_t& samplingPeriod ) pe.exclude_hv = 1; pe.freq = 1; pe.inherit = 1; +#if !defined TRACY_HW_TIMER || !( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) + pe.use_clockid = 1; + pe.clockid = CLOCK_MONOTONIC_RAW; +#endif + if( !noRetirement ) { TracyDebug( "Setup sampling cycles + retirement\n" );