From e076d1d475000c970b74467e814aa2c192ff35ca Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 26 Sep 2017 19:00:25 +0200 Subject: [PATCH] Send source location answer in stream, not as separate packet. --- client/TracyProfiler.cpp | 13 ++----------- client/TracyProfiler.hpp | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index f467df5a..cbbc12ee 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -216,7 +216,7 @@ bool Profiler::SendString( uint64_t str, const char* ptr, QueueType type ) return SendData( buf, sizeof( hdr ) + sizeof( l16 ) + l16 ); } -bool Profiler::SendSourceLocation( uint64_t ptr ) +void Profiler::SendSourceLocation( uint64_t ptr ) { auto srcloc = (const SourceLocation*)ptr; QueueItem item; @@ -226,16 +226,7 @@ bool Profiler::SendSourceLocation( uint64_t ptr ) item.srcloc.function = (uint64_t)srcloc->function; item.srcloc.line = srcloc->line; item.srcloc.color = srcloc->color; - - const auto sz = QueueDataSize[item.hdr.idx]; - - auto buf = m_buffer + m_bufferOffset; - memcpy( buf, &item, sz ); - - m_bufferOffset += sz; - if( m_bufferOffset > TargetFrameSize * 2 ) m_bufferOffset = 0; - - return SendData( buf, sz ); + s_queue.enqueue( GetToken(), std::move( item ) ); } bool Profiler::HandleServerQuery() diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 8cfcbe55..fccf8caf 100755 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -54,7 +54,7 @@ private: bool SendData( const char* data, size_t len ); bool SendString( uint64_t ptr, const char* str, QueueType type ); - bool SendSourceLocation( uint64_t ptr ); + void SendSourceLocation( uint64_t ptr ); bool HandleServerQuery();