From 4d2c7899abace5597a9f5ff1ce34b87e411c8da0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 8 Aug 2019 19:21:39 +0200 Subject: [PATCH] Allow skipping invariant TSC check. --- client/TracyProfiler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index b9de8c1e..225ac1d3 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -286,7 +286,14 @@ static int64_t SetupHwTimer() CpuId( regs, 0x80000001 ); if( !( regs[3] & ( 1 << 27 ) ) ) InitFailure( "CPU doesn't support RDTSCP instruction." ); CpuId( regs, 0x80000007 ); - if( !( regs[3] & ( 1 << 8 ) ) ) InitFailure( "CPU doesn't support invariant TSC." ); + if( !( regs[3] & ( 1 << 8 ) ) ) + { + const char* noCheck = getenv( "TRACY_NO_INVARIANT_CHECK" ); + if( !noCheck || noCheck[0] != '1' ) + { + InitFailure( "CPU doesn't support invariant TSC.\nDefine TRACY_NO_INVARIANT_CHECK=1 to ignore this error, *if you know what you are doing*." ); + } + } return Profiler::GetTime(); }