From 3df4cf8acd7db833baf7fb60aeebe147d41c305d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 12 Sep 2017 01:14:04 +0200 Subject: [PATCH] Don't send unused data. --- client/TracyProfiler.cpp | 10 +++++++++- client/TracyQueue.hpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 8bcd7d93..17e21106 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -99,7 +99,15 @@ void Profiler::Worker() const auto sz = m_queue.try_dequeue_bulk( token, item, BulkSize ); if( sz > 0 ) { - if( sock->Send( item, sz * sizeof( QueueItem ) ) == -1 ) break; + char buf[TargetFrameSize]; + char* ptr = buf; + for( int i=0; iSend( buf, ptr - buf ) == -1 ) break; } else { diff --git a/client/TracyQueue.hpp b/client/TracyQueue.hpp index 61c91a02..9486ecb8 100755 --- a/client/TracyQueue.hpp +++ b/client/TracyQueue.hpp @@ -9,7 +9,8 @@ namespace tracy enum class QueueType : uint8_t { ZoneBegin, - ZoneEnd + ZoneEnd, + NUM_TYPES }; #pragma pack( 1 ) @@ -47,6 +48,13 @@ struct QueueItem enum { QueueItemSize = sizeof( QueueItem ) }; +static const size_t QueueDataSize[] = { + sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), + sizeof( QueueHeader ) + sizeof( QueueZoneEnd ), +}; + +static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" ); + }; #endif