mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Use producer tokens during event insertion.
This commit is contained in:
parent
452e5c5c83
commit
8d3aae24bf
@ -49,14 +49,19 @@ void Profiler::ZoneBegin( QueueZoneBegin&& data )
|
||||
{
|
||||
QueueItem item { QueueType::ZoneBegin, GetTime() };
|
||||
item.zoneBegin = std::move( data );
|
||||
s_instance->m_queue.enqueue( std::move( item ) );
|
||||
s_instance->m_queue.enqueue( GetToken(), std::move( item ) );
|
||||
}
|
||||
|
||||
void Profiler::ZoneEnd( QueueZoneEnd&& data )
|
||||
{
|
||||
QueueItem item { QueueType::ZoneEnd, GetTime() };
|
||||
item.zoneEnd = std::move( data );
|
||||
s_instance->m_queue.enqueue( std::move( item ) );
|
||||
s_instance->m_queue.enqueue( GetToken(), std::move( item ) );
|
||||
}
|
||||
|
||||
Profiler* Profiler::Instance()
|
||||
{
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void Profiler::Worker()
|
||||
|
@ -25,6 +25,13 @@ public:
|
||||
private:
|
||||
void Worker();
|
||||
|
||||
static Profiler* Instance();
|
||||
static moodycamel::ProducerToken& GetToken()
|
||||
{
|
||||
static thread_local moodycamel::ProducerToken token( Instance()->m_queue );
|
||||
return token;
|
||||
}
|
||||
|
||||
int64_t m_timeBegin;
|
||||
std::thread m_thread;
|
||||
std::atomic<bool> m_shutdown;
|
||||
|
Loading…
Reference in New Issue
Block a user