mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Perform zone stack validation.
This commit is contained in:
parent
dcc6bee607
commit
c3b67e4482
@ -1618,7 +1618,7 @@ void Worker::ServerQuery( uint8_t type, uint64_t data )
|
|||||||
m_sock.Send( tmp, DataSize );
|
m_sock.Send( tmp, DataSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
|
bool Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
|
||||||
{
|
{
|
||||||
if( ev.hdr.idx >= (int)QueueType::StringData )
|
if( ev.hdr.idx >= (int)QueueType::StringData )
|
||||||
{
|
{
|
||||||
@ -1654,11 +1654,12 @@ void Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr += sz;
|
ptr += sz;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ptr += QueueDataSize[ev.hdr.idx];
|
ptr += QueueDataSize[ev.hdr.idx];
|
||||||
Process( ev );
|
return Process( ev );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1799,6 +1800,9 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
}
|
}
|
||||||
td->stack.push_back_non_empty( zone );
|
td->stack.push_back_non_empty( zone );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td->zoneIdStack.push_back( td->nextZoneId );
|
||||||
|
td->nextZoneId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread )
|
void Worker::InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread )
|
||||||
@ -2087,7 +2091,7 @@ StringLocation Worker::StoreString( char* str, size_t sz )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::Process( const QueueItem& ev )
|
bool Worker::Process( const QueueItem& ev )
|
||||||
{
|
{
|
||||||
switch( ev.hdr.type )
|
switch( ev.hdr.type )
|
||||||
{
|
{
|
||||||
@ -2101,7 +2105,7 @@ void Worker::Process( const QueueItem& ev )
|
|||||||
ProcessZoneBeginAllocSrcLoc( ev.zoneBegin );
|
ProcessZoneBeginAllocSrcLoc( ev.zoneBegin );
|
||||||
break;
|
break;
|
||||||
case QueueType::ZoneEnd:
|
case QueueType::ZoneEnd:
|
||||||
ProcessZoneEnd( ev.zoneEnd );
|
if( !ProcessZoneEnd( ev.zoneEnd ) ) return false;
|
||||||
break;
|
break;
|
||||||
case QueueType::ZoneValidation:
|
case QueueType::ZoneValidation:
|
||||||
ProcessZoneValidation( ev.zoneValidation );
|
ProcessZoneValidation( ev.zoneValidation );
|
||||||
@ -2211,6 +2215,8 @@ void Worker::Process( const QueueItem& ev )
|
|||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
||||||
@ -2268,12 +2274,17 @@ void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
|||||||
m_pendingSourceLocationPayload.erase( it );
|
m_pendingSourceLocationPayload.erase( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
bool Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
||||||
{
|
{
|
||||||
auto tit = m_threadMap.find( ev.thread );
|
auto tit = m_threadMap.find( ev.thread );
|
||||||
assert( tit != m_threadMap.end() );
|
assert( tit != m_threadMap.end() );
|
||||||
|
|
||||||
auto td = tit->second;
|
auto td = tit->second;
|
||||||
|
assert( !td->zoneIdStack.empty() );
|
||||||
|
auto zoneId = td->zoneIdStack.back_and_pop();
|
||||||
|
if( zoneId != td->nextZoneId ) return false;
|
||||||
|
td->nextZoneId = 0;
|
||||||
|
|
||||||
auto& stack = td->stack;
|
auto& stack = td->stack;
|
||||||
assert( !stack.empty() );
|
assert( !stack.empty() );
|
||||||
auto zone = stack.back_and_pop();
|
auto zone = stack.back_and_pop();
|
||||||
@ -2305,6 +2316,8 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
|||||||
it->second.selfTotal += timeSpan;
|
it->second.selfTotal += timeSpan;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessZoneValidation( const QueueZoneValidation& ev )
|
void Worker::ProcessZoneValidation( const QueueZoneValidation& ev )
|
||||||
|
@ -273,12 +273,12 @@ private:
|
|||||||
void Exec();
|
void Exec();
|
||||||
void ServerQuery( uint8_t type, uint64_t data );
|
void ServerQuery( uint8_t type, uint64_t data );
|
||||||
|
|
||||||
tracy_force_inline void DispatchProcess( const QueueItem& ev, char*& ptr );
|
tracy_force_inline bool DispatchProcess( const QueueItem& ev, char*& ptr );
|
||||||
tracy_force_inline void Process( const QueueItem& ev );
|
tracy_force_inline bool Process( const QueueItem& ev );
|
||||||
tracy_force_inline void ProcessZoneBegin( const QueueZoneBegin& ev );
|
tracy_force_inline void ProcessZoneBegin( const QueueZoneBegin& ev );
|
||||||
tracy_force_inline void ProcessZoneBeginCallstack( const QueueZoneBegin& ev );
|
tracy_force_inline void ProcessZoneBeginCallstack( const QueueZoneBegin& ev );
|
||||||
tracy_force_inline void ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev );
|
tracy_force_inline void ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev );
|
||||||
tracy_force_inline void ProcessZoneEnd( const QueueZoneEnd& ev );
|
tracy_force_inline bool ProcessZoneEnd( const QueueZoneEnd& ev );
|
||||||
tracy_force_inline void ProcessZoneValidation( const QueueZoneValidation& ev );
|
tracy_force_inline void ProcessZoneValidation( const QueueZoneValidation& ev );
|
||||||
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
|
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
|
||||||
tracy_force_inline void ProcessFrameMarkStart( const QueueFrameMark& ev );
|
tracy_force_inline void ProcessFrameMarkStart( const QueueFrameMark& ev );
|
||||||
|
Loading…
Reference in New Issue
Block a user