mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 04:43:53 +00:00
Check if ring buffer was properly mapped.
This commit is contained in:
parent
2b24ad27b2
commit
3d28d1259b
@ -861,9 +861,12 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
TracyDebug( " No access to kernel samples\n" );
|
TracyDebug( " No access to kernel samples\n" );
|
||||||
}
|
}
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCallstack );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CPU cycles + instructions retired
|
// CPU cycles + instructions retired
|
||||||
pe = {};
|
pe = {};
|
||||||
@ -892,10 +895,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCpuCycles );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCpuCycles );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pe.config = PERF_COUNT_HW_INSTRUCTIONS;
|
pe.config = PERF_COUNT_HW_INSTRUCTIONS;
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
@ -904,11 +910,14 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventInstructionsRetired );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventInstructionsRetired );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// cache reference + miss
|
// cache reference + miss
|
||||||
if( !noCache )
|
if( !noCache )
|
||||||
@ -926,10 +935,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCacheReference );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCacheReference );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pe.config = PERF_COUNT_HW_CACHE_MISSES;
|
pe.config = PERF_COUNT_HW_CACHE_MISSES;
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
@ -938,11 +950,14 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCacheMiss );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventCacheMiss );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// branch retired + miss
|
// branch retired + miss
|
||||||
if( !noBranch )
|
if( !noBranch )
|
||||||
@ -955,10 +970,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventBranchRetired );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventBranchRetired );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pe.config = PERF_COUNT_HW_BRANCH_MISSES;
|
pe.config = PERF_COUNT_HW_BRANCH_MISSES;
|
||||||
for( int i=0; i<s_numCpus; i++ )
|
for( int i=0; i<s_numCpus; i++ )
|
||||||
@ -967,11 +985,14 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventBranchMiss );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventBranchMiss );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s_ctxBufferIdx = s_numBuffers;
|
s_ctxBufferIdx = s_numBuffers;
|
||||||
|
|
||||||
@ -1001,10 +1022,13 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 256*1024, fd, EventContextSwitch, i );
|
new( s_ring+s_numBuffers ) RingBuffer( 256*1024, fd, EventContextSwitch, i );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( wakeupId != -1 )
|
if( wakeupId != -1 )
|
||||||
{
|
{
|
||||||
@ -1018,12 +1042,15 @@ bool SysTraceStart( int64_t& samplingPeriod )
|
|||||||
if( fd != -1 )
|
if( fd != -1 )
|
||||||
{
|
{
|
||||||
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventWakeup, i );
|
new( s_ring+s_numBuffers ) RingBuffer( 64*1024, fd, EventWakeup, i );
|
||||||
|
if( s_ring[s_numBuffers].IsValid() )
|
||||||
|
{
|
||||||
s_numBuffers++;
|
s_numBuffers++;
|
||||||
TracyDebug( " Core %i ok\n", i );
|
TracyDebug( " Core %i ok\n", i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TracyDebug( "Ringbuffers in use: %i\n", s_numBuffers );
|
TracyDebug( "Ringbuffers in use: %i\n", s_numBuffers );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user