1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Wrapper for allocation and retrieval of zone extra.

This commit is contained in:
Bartosz Taudul 2020-02-20 23:37:55 +01:00
parent 217c16de20
commit 4bf0af321f
2 changed files with 11 additions and 8 deletions

View File

@ -3822,8 +3822,7 @@ void Worker::ProcessZoneText( const QueueZoneText& ev )
auto zone = stack.back();
auto it = m_pendingCustomStrings.find( ev.text );
assert( it != m_pendingCustomStrings.end() );
if( !HasZoneExtra( *zone ) ) AllocZoneExtra( *zone );
auto& extra = GetZoneExtraMutable( *zone );
auto& extra = RequestZoneExtra( *zone );
if( !extra.text.Active() )
{
extra.text = StringIdx( it->second.idx );
@ -3857,8 +3856,7 @@ void Worker::ProcessZoneName( const QueueZoneText& ev )
auto zone = stack.back();
auto it = m_pendingCustomStrings.find( ev.text );
assert( it != m_pendingCustomStrings.end() );
if( !HasZoneExtra( *zone ) ) AllocZoneExtra( *zone );
auto& extra = GetZoneExtraMutable( *zone );
auto& extra = RequestZoneExtra( *zone );
extra.name = StringIdx( it->second.idx );
m_pendingCustomStrings.erase( it );
}
@ -4513,8 +4511,7 @@ void Worker::ProcessCallstack( const QueueCallstack& ev )
{
case NextCallstackType::Zone:
{
if( !HasZoneExtra( *next.zone ) ) AllocZoneExtra( *next.zone );
auto& extra = GetZoneExtraMutable( *next.zone );
auto& extra = RequestZoneExtra( *next.zone );
extra.callstack.SetVal( m_pendingCallstackId );
break;
}
@ -4551,8 +4548,7 @@ void Worker::ProcessCallstackAlloc( const QueueCallstackAlloc& ev )
{
case NextCallstackType::Zone:
{
if( !HasZoneExtra( *next.zone ) ) AllocZoneExtra( *next.zone );
auto& extra = GetZoneExtraMutable( *next.zone );
auto& extra = RequestZoneExtra( *next.zone );
extra.callstack.SetVal( m_pendingCallstackId );
break;
}
@ -5991,4 +5987,10 @@ void Worker::AllocZoneExtra( ZoneEvent& ev )
memset( &extra, 0, sizeof( extra ) );
}
ZoneExtra& Worker::RequestZoneExtra( ZoneEvent& ev )
{
if( !HasZoneExtra( ev ) ) AllocZoneExtra( ev );
return GetZoneExtraMutable( ev );
}
}

View File

@ -631,6 +631,7 @@ private:
tracy_force_inline ZoneExtra& GetZoneExtraMutable( const ZoneEvent& ev ) { return m_data.zoneExtra[ev.extra]; }
tracy_force_inline void AllocZoneExtra( ZoneEvent& ev );
tracy_force_inline ZoneExtra& RequestZoneExtra( ZoneEvent& ev );
int64_t ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint32_t size, int64_t refTime, int32_t& childIdx );
void ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer );