From be5c94ee098def898854487f8b29e9f8eee7375a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 2 Jan 2020 23:52:03 +0100 Subject: [PATCH] Prevent inlining next block preparation. --- TracyClient.cpp | 1 + client/TracyLfq.cpp | 20 ++++++++++++++++++++ client/TracyLfq.hpp | 17 +---------------- 3 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 client/TracyLfq.cpp diff --git a/TracyClient.cpp b/TracyClient.cpp index 3b427117..6348a103 100644 --- a/TracyClient.cpp +++ b/TracyClient.cpp @@ -23,6 +23,7 @@ #include "common/TracySocket.cpp" #include "client/tracy_rpmalloc.cpp" #include "client/TracyDxt1.cpp" +#include "client/TracyLfq.cpp" #if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6 # include "libbacktrace/alloc.cpp" diff --git a/client/TracyLfq.cpp b/client/TracyLfq.cpp new file mode 100644 index 00000000..35012fd8 --- /dev/null +++ b/client/TracyLfq.cpp @@ -0,0 +1,20 @@ +#include "TracyLfq.hpp" + +namespace tracy +{ + +LfqBlock* LfqProducerImpl::NextBlock( LfqBlock* tailBlk ) +{ + auto next = m_queue->GetFreeBlock(); + assert( next ); + assert( next->next.load() == nullptr ); + assert( tailBlk->next.load() == nullptr ); + 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/TracyLfq.hpp b/client/TracyLfq.hpp index 7819ef84..39441d21 100644 --- a/client/TracyLfq.hpp +++ b/client/TracyLfq.hpp @@ -86,7 +86,7 @@ public: return tail; } - inline LfqBlock* NextBlock( LfqBlock* tailBlk ); + tracy_no_inline LfqBlock* NextBlock( LfqBlock* tailBlk ); std::atomic m_next; std::atomic m_active, m_available; @@ -346,21 +346,6 @@ tracy_force_inline void LfqProducerImpl::CleanupThread() m_queue->ReleaseBlocks( blk ); } -inline LfqBlock* LfqProducerImpl::NextBlock( LfqBlock* tailBlk ) -{ - auto next = m_queue->GetFreeBlock(); - assert( next ); - assert( next->next.load() == nullptr ); - assert( tailBlk->next.load() == nullptr ); - next->thread = m_thread; - tailBlk->next.store( next ); - m_tail.store( next ); - lfq_dataEnd = next->dataEnd; - lfq_tail = &next->tail; - return next; -} - - } #endif