Allow skipping invariant TSC check.

This commit is contained in:
Bartosz Taudul 2019-08-08 19:21:39 +02:00
parent 3a221dafde
commit 4d2c7899ab

View File

@ -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();
}