mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add ZoneEvent re-use pool.
This commit is contained in:
parent
85ae52b725
commit
4f962d2fcc
@ -3547,15 +3547,30 @@ void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
||||
NewZone( zone, m_threadCtx );
|
||||
}
|
||||
|
||||
ZoneEvent* Worker::AllocZoneEvent()
|
||||
{
|
||||
ZoneEvent* ret;
|
||||
if( m_zoneEventPool.empty() )
|
||||
{
|
||||
ret = m_slab.Alloc<ZoneEvent>();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = m_zoneEventPool.back_and_pop();
|
||||
}
|
||||
memset( &ret->text, 0, sizeof( ZoneEvent::text ) + sizeof( ZoneEvent::callstack ) + sizeof( ZoneEvent::name ) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
auto zone = AllocZoneEvent();
|
||||
ProcessZoneBeginImpl( zone, ev );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginCallstack( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
auto zone = AllocZoneEvent();
|
||||
ProcessZoneBeginImpl( zone, ev );
|
||||
|
||||
auto& next = m_nextCallstack[m_threadCtx];
|
||||
@ -3585,13 +3600,13 @@ void Worker::ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBe
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
auto zone = AllocZoneEvent();
|
||||
ProcessZoneBeginAllocSrcLocImpl( zone, ev );
|
||||
}
|
||||
|
||||
void Worker::ProcessZoneBeginAllocSrcLocCallstack( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
auto zone = AllocZoneEvent();
|
||||
ProcessZoneBeginAllocSrcLocImpl( zone, ev );
|
||||
|
||||
auto& next = m_nextCallstack[m_threadCtx];
|
||||
|
||||
@ -475,6 +475,7 @@ private:
|
||||
tracy_force_inline void ProcessThreadWakeup( const QueueThreadWakeup& ev );
|
||||
tracy_force_inline void ProcessTidToPid( const QueueTidToPid& ev );
|
||||
|
||||
tracy_force_inline ZoneEvent* AllocZoneEvent();
|
||||
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
|
||||
@ -700,6 +701,8 @@ private:
|
||||
int m_netWriteCnt = 0;
|
||||
std::mutex m_netWriteLock;
|
||||
std::condition_variable m_netWriteCv;
|
||||
|
||||
Vector<ZoneEvent*> m_zoneEventPool;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user