1
0
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:
Bartosz Taudul 2017-09-27 00:30:02 +02:00
parent ffa5930a23
commit f584bf76e8
2 changed files with 3 additions and 3 deletions

View File

@ -35,6 +35,8 @@ static moodycamel::ProducerToken& GetToken()
return token;
}
static std::atomic<uint64_t> s_id( 0 );
#ifndef TRACY_DISABLE
Profiler s_profiler;
@ -45,7 +47,6 @@ static Profiler* s_instance = nullptr;
Profiler::Profiler()
: m_mainThread( GetThreadHandle() )
, m_shutdown( false )
, m_id( 0 )
, m_stream( LZ4_createStream() )
, m_buffer( new char[TargetFrameSize*3] )
, m_bufferOffset( 0 )
@ -75,7 +76,7 @@ Profiler::~Profiler()
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 )

View File

@ -67,7 +67,6 @@ private:
uint64_t m_mainThread;
std::thread m_thread;
std::atomic<bool> m_shutdown;
std::atomic<uint64_t> m_id;
std::unique_ptr<Socket> m_sock;
LZ4_stream_t* m_stream;