mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Try to check if cntcvt reads are monotonic.
https://lore.kernel.org/patchwork/patch/904607/
This commit is contained in:
parent
7f57b3dba9
commit
94ed1c637c
@ -203,6 +203,26 @@ static int64_t SetupHwTimer()
|
|||||||
|
|
||||||
sigaction( SIGILL, &oldact, nullptr );
|
sigaction( SIGILL, &oldact, nullptr );
|
||||||
GetTimeImpl = GetTimeImplCntvct;
|
GetTimeImpl = GetTimeImplCntvct;
|
||||||
|
|
||||||
|
// Check if cntcvt is monotonic (there is faulty hw out there)
|
||||||
|
enum { NumProbes = 32 * 1024 };
|
||||||
|
int64_t probe[NumProbes];
|
||||||
|
for( int j=0; j<10; j++ )
|
||||||
|
{
|
||||||
|
for( int i=0; i<NumProbes; i++ )
|
||||||
|
{
|
||||||
|
probe[i] = Profiler::GetTime();
|
||||||
|
}
|
||||||
|
for( int i=1; i<NumProbes; i++ )
|
||||||
|
{
|
||||||
|
if( probe[i] < probe[i-1] )
|
||||||
|
{
|
||||||
|
GetTimeImpl = GetTimeImplFallback;
|
||||||
|
return Profiler::GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Profiler::GetTime();
|
return Profiler::GetTime();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user