From 9b0044838e56fd49248aefe8ce31f4fca4b4aeb6 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 2 Jan 2020 23:41:37 +0100 Subject: [PATCH] Enqueue can be a static operation. --- TracyLua.hpp | 45 ++++++--------- TracyOpenGL.hpp | 25 ++++----- client/TracyLfq.hpp | 56 ++++++++++--------- client/TracyLock.hpp | 20 +++---- client/TracyProfiler.cpp | 116 +++++++++++++++++---------------------- client/TracyProfiler.hpp | 55 ++++++++----------- client/TracyScoped.hpp | 25 ++++----- client/TracySysTrace.cpp | 30 ++++------ 8 files changed, 161 insertions(+), 211 deletions(-) diff --git a/TracyLua.hpp b/TracyLua.hpp index 223663d3..70200c66 100644 --- a/TracyLua.hpp +++ b/TracyLua.hpp @@ -180,11 +180,10 @@ static tracy_force_inline void SendLuaCallstack( lua_State* L, uint32_t depth ) assert( dst - ptr == spaceNeeded + 4 ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::CallstackAlloc ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::CallstackAlloc ); MemWrite( &item->callstackAlloc.ptr, (uint64_t)ptr ); MemWrite( &item->callstackAlloc.nativePtr, (uint64_t)Callstack( depth ) ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static inline int LuaZoneBeginS( lua_State* L ) @@ -202,11 +201,10 @@ static inline int LuaZoneBeginS( lua_State* L ) const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLocCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLocCallstack ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); #ifdef TRACY_CALLSTACK const uint32_t depth = TRACY_CALLSTACK; @@ -235,11 +233,10 @@ static inline int LuaZoneBeginNS( lua_State* L ) const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLocCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLocCallstack ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); #ifdef TRACY_CALLSTACK const uint32_t depth = TRACY_CALLSTACK; @@ -270,11 +267,10 @@ static inline int LuaZoneBegin( lua_State* L ) const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLoc ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLoc ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; #endif } @@ -299,11 +295,10 @@ static inline int LuaZoneBeginN( lua_State* L ) const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLoc ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBeginAllocSrcLoc ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; #endif } @@ -322,10 +317,9 @@ static inline int LuaZoneEnd( lua_State* L ) #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneEnd ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneEnd ); MemWrite( &item->zoneEnd.time, Profiler::GetTime() ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; } @@ -347,10 +341,9 @@ static inline int LuaZoneText( lua_State* L ) memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneText ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneText ); MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; } @@ -372,10 +365,9 @@ static inline int LuaZoneName( lua_State* L ) memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneName ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneName ); MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; } @@ -392,11 +384,10 @@ static inline int LuaMessage( lua_State* L ) memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::Message ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::Message ); MemWrite( &item->message.time, Profiler::GetTime() ); MemWrite( &item->message.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); return 0; } diff --git a/TracyOpenGL.hpp b/TracyOpenGL.hpp index 94e08175..31dab14d 100644 --- a/TracyOpenGL.hpp +++ b/TracyOpenGL.hpp @@ -103,8 +103,7 @@ public: const float period = 1.f; const auto thread = GetThreadHandle(); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::GpuNewContext ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::GpuNewContext ); MemWrite( &item->gpuNewContext.cpuTime, tcpu ); MemWrite( &item->gpuNewContext.gpuTime, tgpu ); MemWrite( &item->gpuNewContext.thread, thread ); @@ -116,7 +115,7 @@ public: GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } void Collect() @@ -133,7 +132,6 @@ public: } #endif - auto& prod = GetProducer(); while( m_tail != m_head ) { GLint available; @@ -144,11 +142,11 @@ public: glGetQueryObjectui64v( m_query[m_tail], GL_QUERY_RESULT, &time ); char* nextPtr; - auto item = prod.PrepareNext( nextPtr, QueueType::GpuTime ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::GpuTime ); MemWrite( &item->gpuTime.gpuTime, (int64_t)time ); MemWrite( &item->gpuTime.queryId, (uint16_t)m_tail ); MemWrite( &item->gpuTime.context, m_context ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); m_tail = ( m_tail + 1 ) % QueryCount; } @@ -195,14 +193,13 @@ public: glQueryCounter( GetGpuCtx().ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::GpuZoneBegin ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::GpuZoneBegin ); MemWrite( &item->gpuZoneBegin.cpuTime, Profiler::GetTime() ); MemWrite( &item->gpuZoneBegin.srcloc, (uint64_t)srcloc ); memset( &item->gpuZoneBegin.thread, 0, sizeof( item->gpuZoneBegin.thread ) ); MemWrite( &item->gpuZoneBegin.queryId, uint16_t( queryId ) ); MemWrite( &item->gpuZoneBegin.context, GetGpuCtx().ptr->GetId() ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline GpuCtxScope( const SourceLocationData* srcloc, int depth ) @@ -218,14 +215,13 @@ public: const auto thread = GetThreadHandle(); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::GpuZoneBeginCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::GpuZoneBeginCallstack ); MemWrite( &item->gpuZoneBegin.cpuTime, Profiler::GetTime() ); MemWrite( &item->gpuZoneBegin.srcloc, (uint64_t)srcloc ); MemWrite( &item->gpuZoneBegin.thread, thread ); MemWrite( &item->gpuZoneBegin.queryId, uint16_t( queryId ) ); MemWrite( &item->gpuZoneBegin.context, GetGpuCtx().ptr->GetId() ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); GetProfiler().SendCallstack( depth ); } @@ -239,13 +235,12 @@ public: glQueryCounter( GetGpuCtx().ptr->TranslateOpenGlQueryId( queryId ), GL_TIMESTAMP ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::GpuZoneEnd ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::GpuZoneEnd ); MemWrite( &item->gpuZoneEnd.cpuTime, Profiler::GetTime() ); memset( &item->gpuZoneEnd.thread, 0, sizeof( item->gpuZoneEnd.thread ) ); MemWrite( &item->gpuZoneEnd.queryId, uint16_t( queryId ) ); MemWrite( &item->gpuZoneEnd.context, GetGpuCtx().ptr->GetId() ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } private: diff --git a/client/TracyLfq.hpp b/client/TracyLfq.hpp index 555f824a..7819ef84 100644 --- a/client/TracyLfq.hpp +++ b/client/TracyLfq.hpp @@ -6,6 +6,7 @@ #include #include +#include "../common/TracyApi.h" #include "../common/TracyAlign.hpp" #include "../common/TracyAlloc.hpp" #include "../common/TracyForceInline.hpp" @@ -15,7 +16,11 @@ namespace tracy { + class LockFreeQueue; +class LfqProducer; + +TRACY_API LfqProducer& GetProducer(); class LfqBlock @@ -54,6 +59,9 @@ public: }; +extern thread_local const char* lfq_dataEnd; +extern thread_local std::atomic* lfq_tail; + class LfqProducerImpl { public: @@ -72,28 +80,10 @@ public: tracy_force_inline char* PrepareNext( char*& nextPtr, size_t sz ) { - auto tailBlk = m_tail.load(); + auto tailBlk = NextBlock( m_tail.load() ); auto tail = tailBlk->tail.load(); - assert( tail >= tailBlk->data ); - auto np = tail + sz; - if( np <= tailBlk->dataEnd ) - { - nextPtr = np; - return tail; - } - else - { - tailBlk = NextBlock( tailBlk ); - tail = tailBlk->tail.load(); - nextPtr = tail + sz; - return tail; - } - } - - tracy_force_inline void CommitNext( char* nextPtr ) - { - auto tailBlk = m_tail.load(); - tailBlk->tail.store( nextPtr ); + nextPtr = tail + sz; + return tail; } inline LfqBlock* NextBlock( LfqBlock* tailBlk ); @@ -123,21 +113,31 @@ public: inline LfqProducer& operator=( LfqProducer&& ) noexcept; - tracy_force_inline QueueItem* PrepareNext( char*& nextPtr, QueueType type ) + static tracy_force_inline QueueItem* PrepareNext( char*& nextPtr, QueueType type ) { auto item = (QueueItem*)PrepareNext( nextPtr, QueueDataSize[(uint8_t)type] ); MemWrite( &item->hdr.type, type ); return item; } - tracy_force_inline char* PrepareNext( char*& nextPtr, size_t sz ) + static tracy_force_inline char* PrepareNext( char*& nextPtr, size_t sz ) { - return m_prod->PrepareNext( nextPtr, sz ); + auto tail = lfq_tail->load(); + auto np = tail + sz; + if( np <= lfq_dataEnd ) + { + nextPtr = np; + return tail; + } + else + { + return GetProducer().m_prod->PrepareNext( nextPtr, sz ); + } } - tracy_force_inline void CommitNext( char* nextPtr ) + static tracy_force_inline void CommitNext( char* nextPtr ) { - m_prod->CommitNext( nextPtr ); + lfq_tail->store( nextPtr ); } @@ -331,6 +331,8 @@ tracy_force_inline void LfqProducerImpl::PrepareThread() assert( blk ); assert( blk->next.load() == nullptr ); blk->thread = m_thread; + lfq_dataEnd = blk->dataEnd; + lfq_tail = &blk->tail; m_head.store( blk ); m_tail.store( blk ); } @@ -353,6 +355,8 @@ inline LfqBlock* LfqProducerImpl::NextBlock( LfqBlock* tailBlk ) next->thread = m_thread; tailBlk->next.store( next ); m_tail.store( next ); + lfq_dataEnd = next->dataEnd; + lfq_tail = &next->tail; return next; } diff --git a/client/TracyLock.hpp b/client/TracyLock.hpp index 5b309c69..1ccb19c6 100644 --- a/client/TracyLock.hpp +++ b/client/TracyLock.hpp @@ -24,8 +24,7 @@ public: assert( m_id != std::numeric_limits::max() ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::LockAnnounce ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::LockAnnounce ); MemWrite( &item->lockAnnounce.id, m_id ); MemWrite( &item->lockAnnounce.time, Profiler::GetTime() ); MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc ); @@ -33,7 +32,7 @@ public: #ifdef TRACY_ON_DEMAND GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } LockableCtx( const LockableCtx& ) = delete; @@ -42,15 +41,14 @@ public: tracy_force_inline ~LockableCtx() { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::LockTerminate ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::LockTerminate ); MemWrite( &item->lockTerminate.id, m_id ); MemWrite( &item->lockTerminate.time, Profiler::GetTime() ); MemWrite( &item->lockTerminate.type, LockType::Lockable ); #ifdef TRACY_ON_DEMAND GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline bool BeforeLock() @@ -222,8 +220,7 @@ public: assert( m_id != std::numeric_limits::max() ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::LockAnnounce ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::LockAnnounce ); MemWrite( &item->lockAnnounce.id, m_id ); MemWrite( &item->lockAnnounce.time, Profiler::GetTime() ); MemWrite( &item->lockAnnounce.lckloc, (uint64_t)srcloc ); @@ -233,7 +230,7 @@ public: GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } SharedLockableCtx( const SharedLockableCtx& ) = delete; @@ -242,8 +239,7 @@ public: tracy_force_inline ~SharedLockableCtx() { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::LockTerminate ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::LockTerminate ); MemWrite( &item->lockTerminate.id, m_id ); MemWrite( &item->lockTerminate.time, Profiler::GetTime() ); MemWrite( &item->lockTerminate.type, LockType::SharedLockable ); @@ -252,7 +248,7 @@ public: GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline bool BeforeLock() diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 983edf24..0ffa4545 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -583,11 +583,10 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::CrashReport ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::CrashReport ); item->crashReport.time = Profiler::GetTime(); item->crashReport.text = (uint64_t)s_crashText; - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); GetProfiler().SendCallstack( 60, "KiUserExceptionDispatcher" ); } @@ -622,9 +621,8 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::Crash ); - prod.CommitNext( nextPtr ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::Crash ); + LfqProducer::CommitNext( nextPtr ); } std::this_thread::sleep_for( std::chrono::milliseconds( 500 ) ); @@ -815,11 +813,10 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::CrashReport ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::CrashReport ); item->crashReport.time = Profiler::GetTime(); item->crashReport.text = (uint64_t)s_crashText; - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); GetProfiler().SendCallstack( 60, "__kernel_rt_sigreturn" ); } @@ -843,9 +840,8 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::Crash ); - prod.CommitNext( nextPtr ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::Crash ); + LfqProducer::CommitNext( nextPtr ); } std::this_thread::sleep_for( std::chrono::milliseconds( 500 ) ); @@ -857,6 +853,9 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ ) #endif +thread_local const char* lfq_dataEnd; +thread_local std::atomic* lfq_tail; + static Profiler* s_instance; static Thread* s_thread; static Thread* s_compressThread; @@ -1547,15 +1546,14 @@ void Profiler::CompressWorker() tracy_free( fi->image ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::FrameImage ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::FrameImage ); MemWrite( &item->frameImage.image, (uint64_t)etc1buf ); MemWrite( &item->frameImage.frame, fi->frame ); MemWrite( &item->frameImage.w, w ); MemWrite( &item->frameImage.h, h ); uint8_t flip = fi->flip; MemWrite( &item->frameImage.flip, flip ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); fi++; } @@ -2513,13 +2511,12 @@ void Profiler::ReportTopology() idx++; } - auto& prod = GetProducer(); for( uint32_t i=0; icpuTopology.package, data.package ); MemWrite( &item->cpuTopology.core, data.core ); MemWrite( &item->cpuTopology.thread, data.thread ); @@ -2528,7 +2525,7 @@ void Profiler::ReportTopology() DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_free( cpuData ); @@ -2560,13 +2557,12 @@ void Profiler::ReportTopology() cpuData[i].core = uint32_t( atoi( buf ) ); } - auto& prod = GetProducer(); for( uint32_t i=0; icpuTopology.package, data.package ); MemWrite( &item->cpuTopology.core, data.core ); MemWrite( &item->cpuTopology.thread, data.thread ); @@ -2575,7 +2571,7 @@ void Profiler::ReportTopology() DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_free( cpuData ); @@ -2590,10 +2586,9 @@ void Profiler::SendCallstack( int depth, const char* skipBefore ) CutCallstack( ptr, skipBefore ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::Callstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::Callstack ); MemWrite( &item->callstack.ptr, ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); #endif } @@ -2635,11 +2630,10 @@ void Profiler::ProcessSysTime() m_sysTimeLast = t; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::SysTimeReport ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::SysTimeReport ); MemWrite( &item->sysTime.time, GetTime() ); MemWrite( &item->sysTime.sysTime, sysTime ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } } } @@ -2648,8 +2642,7 @@ void Profiler::ProcessSysTime() void Profiler::ParameterSetup( uint32_t idx, const char* name, bool isBool, int32_t val ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ParamSetup ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ParamSetup ); tracy::MemWrite( &item->paramSetup.idx, idx ); tracy::MemWrite( &item->paramSetup.name, (uint64_t)name ); tracy::MemWrite( &item->paramSetup.isBool, (uint8_t)isBool ); @@ -2659,7 +2652,7 @@ void Profiler::ParameterSetup( uint32_t idx, const char* name, bool isBool, int3 GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } void Profiler::HandleParameter( uint64_t payload ) @@ -2688,21 +2681,20 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_l const auto id = tracy::GetProfiler().GetNextZoneId(); ctx.id = id; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneBegin ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneBegin ); tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() ); tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } return ctx; } @@ -2719,21 +2711,20 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___trac const auto id = tracy::GetProfiler().GetNextZoneId(); ctx.id = id; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneBeginCallstack ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneBeginCallstack ); tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() ); tracy::MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } tracy::GetProfiler().SendCallstack( depth ); @@ -2756,21 +2747,20 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int act const auto id = tracy::GetProfiler().GetNextZoneId(); ctx.id = id; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneBeginAllocSrcLoc ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneBeginAllocSrcLoc ); tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() ); tracy::MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } return ctx; } @@ -2791,21 +2781,20 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srclo const auto id = tracy::GetProfiler().GetNextZoneId(); ctx.id = id; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneBeginAllocSrcLocCallstack ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneBeginAllocSrcLocCallstack ); tracy::MemWrite( &item->zoneBegin.time, tracy::Profiler::GetTime() ); tracy::MemWrite( &item->zoneBegin.srcloc, srcloc ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } tracy::GetProfiler().SendCallstack( depth ); @@ -2815,20 +2804,19 @@ TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srclo TRACY_API void ___tracy_emit_zone_end( TracyCZoneCtx ctx ) { if( !ctx.active ) return; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, ctx.id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneEnd ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneEnd ); tracy::MemWrite( &item->zoneEnd.time, tracy::Profiler::GetTime() ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } } @@ -2838,20 +2826,19 @@ TRACY_API void ___tracy_emit_zone_text( TracyCZoneCtx ctx, const char* txt, size auto ptr = (char*)tracy::tracy_malloc( size+1 ); memcpy( ptr, txt, size ); ptr[size] = '\0'; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, ctx.id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneText ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneText ); tracy::MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } } @@ -2861,20 +2848,19 @@ TRACY_API void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size auto ptr = (char*)tracy::tracy_malloc( size+1 ); memcpy( ptr, txt, size ); ptr[size] = '\0'; - auto& prod = tracy::GetProducer(); #ifndef TRACY_NO_VERIFY { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneValidation ); tracy::MemWrite( &item->zoneValidation.id, ctx.id ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } #endif { char* nextPtr; - auto item = prod.PrepareNext( nextPtr, tracy::QueueType::ZoneName ); + auto item = tracy::LfqProducer::PrepareNext( nextPtr, tracy::QueueType::ZoneName ); tracy::MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + tracy::LfqProducer::CommitNext( nextPtr ); } } diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index b0c41755..32a66118 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -151,11 +151,10 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::FrameMarkMsg ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::FrameMarkMsg ); MemWrite( &item->frameMark.time, GetTime() ); MemWrite( &item->frameMark.name, uint64_t( name ) ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void SendFrameMark( const char* name, QueueType type ) @@ -198,13 +197,12 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::PlotData ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::PlotData ); MemWrite( &item->plotData.name, (uint64_t)name ); MemWrite( &item->plotData.time, GetTime() ); MemWrite( &item->plotData.type, PlotDataType::Int ); MemWrite( &item->plotData.data.i, val ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void PlotData( const char* name, float val ) @@ -213,13 +211,12 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::PlotData ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::PlotData ); MemWrite( &item->plotData.name, (uint64_t)name ); MemWrite( &item->plotData.time, GetTime() ); MemWrite( &item->plotData.type, PlotDataType::Float ); MemWrite( &item->plotData.data.f, val ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void PlotData( const char* name, double val ) @@ -228,20 +225,18 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::PlotData ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::PlotData ); MemWrite( &item->plotData.name, (uint64_t)name ); MemWrite( &item->plotData.time, GetTime() ); MemWrite( &item->plotData.type, PlotDataType::Double ); MemWrite( &item->plotData.data.d, val ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void ConfigurePlot( const char* name, PlotFormatType type ) { char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::PlotConfig ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::PlotConfig ); MemWrite( &item->plotConfig.name, (uint64_t)name ); MemWrite( &item->plotConfig.type, (uint8_t)type ); @@ -249,7 +244,7 @@ public: GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void Message( const char* txt, size_t size, int callstack ) @@ -261,11 +256,10 @@ public: memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, callstack == 0 ? QueueType::Message : QueueType::MessageCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, callstack == 0 ? QueueType::Message : QueueType::MessageCallstack ); MemWrite( &item->message.time, GetTime() ); MemWrite( &item->message.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack ); } @@ -276,11 +270,10 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageLiteral : QueueType::MessageLiteralCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageLiteral : QueueType::MessageLiteralCallstack ); MemWrite( &item->message.time, GetTime() ); MemWrite( &item->message.text, (uint64_t)txt ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack ); } @@ -294,14 +287,13 @@ public: memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack ); MemWrite( &item->messageColor.time, GetTime() ); MemWrite( &item->messageColor.text, (uint64_t)ptr ); MemWrite( &item->messageColor.r, uint8_t( ( color ) & 0xFF ) ); MemWrite( &item->messageColor.g, uint8_t( ( color >> 8 ) & 0xFF ) ); MemWrite( &item->messageColor.b, uint8_t( ( color >> 16 ) & 0xFF ) ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack ); } @@ -312,14 +304,13 @@ public: if( !GetProfiler().IsConnected() ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, callstack == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack ); MemWrite( &item->messageColor.time, GetTime() ); MemWrite( &item->messageColor.text, (uint64_t)txt ); MemWrite( &item->messageColor.r, uint8_t( ( color ) & 0xFF ) ); MemWrite( &item->messageColor.g, uint8_t( ( color >> 8 ) & 0xFF ) ); MemWrite( &item->messageColor.b, uint8_t( ( color >> 16 ) & 0xFF ) ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack ); } @@ -330,8 +321,7 @@ public: memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::MessageAppInfo ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::MessageAppInfo ); MemWrite( &item->message.time, GetTime() ); MemWrite( &item->message.text, (uint64_t)ptr ); @@ -339,7 +329,7 @@ public: GetProfiler().DeferItem( *item ); #endif - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } static tracy_force_inline void MemAlloc( const void* ptr, size_t size ) @@ -413,10 +403,9 @@ public: #ifdef TRACY_HAS_CALLSTACK auto ptr = Callstack( depth ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::Callstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::Callstack ); MemWrite( &item->callstack.ptr, ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); #endif } diff --git a/client/TracyScoped.hpp b/client/TracyScoped.hpp index aa32dcf2..598be26b 100644 --- a/client/TracyScoped.hpp +++ b/client/TracyScoped.hpp @@ -25,11 +25,10 @@ public: { if( !m_active ) return; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBegin ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBegin ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true ) @@ -42,11 +41,10 @@ public: { if( !m_active ) return; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneBeginCallstack ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneBeginCallstack ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); GetProfiler().SendCallstack( depth ); } @@ -58,10 +56,9 @@ public: if( GetProfiler().ConnectionId() != m_connectionId ) return; #endif char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneEnd ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneEnd ); MemWrite( &item->zoneEnd.time, Profiler::GetTime() ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline void Text( const char* txt, size_t size ) @@ -74,10 +71,9 @@ public: memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneText ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneText ); MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } tracy_force_inline void Name( const char* txt, size_t size ) @@ -90,10 +86,9 @@ public: memcpy( ptr, txt, size ); ptr[size] = '\0'; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ZoneName ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ZoneName ); MemWrite( &item->zoneText.text, (uint64_t)ptr ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } private: diff --git a/client/TracySysTrace.cpp b/client/TracySysTrace.cpp index ac24f3ac..289a36af 100644 --- a/client/TracySysTrace.cpp +++ b/client/TracySysTrace.cpp @@ -67,8 +67,7 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record ) const auto cswitch = (const CSwitch*)record->UserData; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ContextSwitch ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ContextSwitch ); MemWrite( &item->contextSwitch.time, hdr.TimeStamp.QuadPart ); memcpy( &item->contextSwitch.oldThread, &cswitch->oldThreadId, sizeof( cswitch->oldThreadId ) ); memcpy( &item->contextSwitch.newThread, &cswitch->newThreadId, sizeof( cswitch->newThreadId ) ); @@ -77,19 +76,18 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record ) MemWrite( &item->contextSwitch.cpu, record->BufferContext.ProcessorNumber ); MemWrite( &item->contextSwitch.reason, cswitch->oldThreadWaitReason ); MemWrite( &item->contextSwitch.state, cswitch->oldThreadState ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } else if( hdr.EventDescriptor.Opcode == 50 ) { const auto rt = (const ReadyThread*)record->UserData; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ThreadWakeup ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ThreadWakeup ); MemWrite( &item->threadWakeup.time, hdr.TimeStamp.QuadPart ); memcpy( &item->threadWakeup.thread, &rt->threadId, sizeof( rt->threadId ) ); memset( ((char*)&item->threadWakeup.thread)+4, 0, 4 ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } } @@ -277,11 +275,10 @@ void SysTraceSendExternalName( uint64_t thread ) { uint64_t _pid = pid; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::TidToPid ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::TidToPid ); MemWrite( &item->tidToPid.tid, thread ); MemWrite( &item->tidToPid.pid, _pid ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } if( pid == 4 ) { @@ -603,15 +600,14 @@ static void HandleTraceLine( const char* line ) uint8_t reason = 100; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ContextSwitch ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ContextSwitch ); MemWrite( &item->contextSwitch.time, time ); MemWrite( &item->contextSwitch.oldThread, oldPid ); MemWrite( &item->contextSwitch.newThread, newPid ); MemWrite( &item->contextSwitch.cpu, cpu ); MemWrite( &item->contextSwitch.reason, reason ); MemWrite( &item->contextSwitch.state, oldState ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } else if( memcmp( line, "sched_wakeup", 12 ) == 0 ) { @@ -623,11 +619,10 @@ static void HandleTraceLine( const char* line ) const auto pid = ReadNumber( line ); char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::ThreadWakeup ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::ThreadWakeup ); MemWrite( &item->threadWakeup.time, time ); MemWrite( &item->threadWakeup.thread, pid ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } } @@ -822,11 +817,10 @@ void SysTraceSendExternalName( uint64_t thread ) { uint64_t _pid = pid; char* nextPtr; - auto& prod = GetProducer(); - auto item = prod.PrepareNext( nextPtr, QueueType::TidToPid ); + auto item = LfqProducer::PrepareNext( nextPtr, QueueType::TidToPid ); MemWrite( &item->tidToPid.tid, thread ); MemWrite( &item->tidToPid.pid, _pid ); - prod.CommitNext( nextPtr ); + LfqProducer::CommitNext( nextPtr ); } sprintf( fn, "/proc/%i/comm", pid ); f = fopen( fn, "rb" );