From f584bf76e89555dbc64a21e3bd85f8f7ddde6466 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 27 Sep 2017 00:30:02 +0200 Subject: [PATCH] Profiler ID can be static (one less instruction). --- client/TracyProfiler.cpp | 5 +++-- client/TracyProfiler.hpp | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index cbbc12ee..42918cdf 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -35,6 +35,8 @@ static moodycamel::ProducerToken& GetToken() return token; } +static std::atomic 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 ) diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index fccf8caf..ffcaa845 100755 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -67,7 +67,6 @@ private: uint64_t m_mainThread; std::thread m_thread; std::atomic m_shutdown; - std::atomic m_id; std::unique_ptr m_sock; LZ4_stream_t* m_stream;