Don't require time to be available for samples.

This commit is contained in:
Bartosz Taudul 2021-12-02 01:29:22 +01:00
parent 051b1ba8f5
commit 74e2a63516
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -928,20 +928,6 @@ static void SetupSampling( int64_t& samplingPeriod )
InitRpmalloc(); InitRpmalloc();
sched_param sp = { 5 }; sched_param sp = { 5 };
pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp ); pthread_setschedparam( pthread_self(), SCHED_FIFO, &sp );
#if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
for( int i=0; i<s_numBuffers; i++ )
{
if( s_ring[i].GetId() == EventCallstack && !s_ring[i].CheckTscCaps() )
{
for( int j=0; j<s_numBuffers; j++ ) s_ring[j].~RingBuffer<RingBufSize>();
tracy_free_fast( s_ring );
const char* err = "Tracy Profiler: sampling is disabled due to non-native scheduler clock. Are you running under a VM?";
TracyDebug( err );
Profiler::MessageAppInfo( err, strlen( err ) );
return;
}
}
#endif
for( int i=0; i<s_numBuffers; i++ ) s_ring[i].Enable(); for( int i=0; i<s_numBuffers; i++ ) s_ring[i].Enable();
for(;;) for(;;)
{ {
@ -990,9 +976,7 @@ static void SetupSampling( int64_t& samplingPeriod )
{ {
#if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) #if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
t0 = ring.ConvertTimeToTsc( t0 ); t0 = ring.ConvertTimeToTsc( t0 );
if( t0 != 0 )
#endif #endif
{
auto trace = (uint64_t*)tracy_malloc_fast( ( 1 + cnt ) * sizeof( uint64_t ) ); auto trace = (uint64_t*)tracy_malloc_fast( ( 1 + cnt ) * sizeof( uint64_t ) );
ring.Read( trace+1, offset, sizeof( uint64_t ) * cnt ); ring.Read( trace+1, offset, sizeof( uint64_t ) * cnt );
@ -1033,7 +1017,6 @@ static void SetupSampling( int64_t& samplingPeriod )
TracyLfqCommit; TracyLfqCommit;
} }
} }
}
else else
{ {
// Layout: // Layout:
@ -1047,9 +1030,7 @@ static void SetupSampling( int64_t& samplingPeriod )
#if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) #if defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
t0 = ring.ConvertTimeToTsc( t0 ); t0 = ring.ConvertTimeToTsc( t0 );
if( t0 != 0 )
#endif #endif
{
QueueType type; QueueType type;
switch( id ) switch( id )
{ {
@ -1082,7 +1063,6 @@ static void SetupSampling( int64_t& samplingPeriod )
TracyLfqCommit; TracyLfqCommit;
} }
} }
}
pos += hdr.size; pos += hdr.size;
} }
assert( pos == end ); assert( pos == end );