mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Profiler ID can be static (one less instruction).
This commit is contained in:
parent
ffa5930a23
commit
f584bf76e8
@ -35,6 +35,8 @@ static moodycamel::ProducerToken& GetToken()
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::atomic<uint64_t> s_id( 0 );
|
||||||
|
|
||||||
|
|
||||||
#ifndef TRACY_DISABLE
|
#ifndef TRACY_DISABLE
|
||||||
Profiler s_profiler;
|
Profiler s_profiler;
|
||||||
@ -45,7 +47,6 @@ static Profiler* s_instance = nullptr;
|
|||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
: m_mainThread( GetThreadHandle() )
|
: m_mainThread( GetThreadHandle() )
|
||||||
, m_shutdown( false )
|
, m_shutdown( false )
|
||||||
, m_id( 0 )
|
|
||||||
, m_stream( LZ4_createStream() )
|
, m_stream( LZ4_createStream() )
|
||||||
, m_buffer( new char[TargetFrameSize*3] )
|
, m_buffer( new char[TargetFrameSize*3] )
|
||||||
, m_bufferOffset( 0 )
|
, m_bufferOffset( 0 )
|
||||||
@ -75,7 +76,7 @@ Profiler::~Profiler()
|
|||||||
|
|
||||||
uint64_t Profiler::GetNewId()
|
uint64_t Profiler::GetNewId()
|
||||||
{
|
{
|
||||||
return s_instance->m_id.fetch_add( 1, std::memory_order_relaxed );
|
return s_id.fetch_add( 1, std::memory_order_relaxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Profiler::ZoneBegin( QueueZoneBegin&& data )
|
uint64_t Profiler::ZoneBegin( QueueZoneBegin&& data )
|
||||||
|
@ -67,7 +67,6 @@ private:
|
|||||||
uint64_t m_mainThread;
|
uint64_t m_mainThread;
|
||||||
std::thread m_thread;
|
std::thread m_thread;
|
||||||
std::atomic<bool> m_shutdown;
|
std::atomic<bool> m_shutdown;
|
||||||
std::atomic<uint64_t> m_id;
|
|
||||||
std::unique_ptr<Socket> m_sock;
|
std::unique_ptr<Socket> m_sock;
|
||||||
|
|
||||||
LZ4_stream_t* m_stream;
|
LZ4_stream_t* m_stream;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user