mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Don't send unused data.
This commit is contained in:
parent
25d7cebd8a
commit
3df4cf8acd
@ -99,7 +99,15 @@ void Profiler::Worker()
|
|||||||
const auto sz = m_queue.try_dequeue_bulk( token, item, BulkSize );
|
const auto sz = m_queue.try_dequeue_bulk( token, item, BulkSize );
|
||||||
if( sz > 0 )
|
if( sz > 0 )
|
||||||
{
|
{
|
||||||
if( sock->Send( item, sz * sizeof( QueueItem ) ) == -1 ) break;
|
char buf[TargetFrameSize];
|
||||||
|
char* ptr = buf;
|
||||||
|
for( int i=0; i<sz; i++ )
|
||||||
|
{
|
||||||
|
const auto dsz = QueueDataSize[(uint8_t)item[i].hdr.type];
|
||||||
|
memcpy( ptr, item+i, dsz );
|
||||||
|
ptr += dsz;
|
||||||
|
}
|
||||||
|
if( sock->Send( buf, ptr - buf ) == -1 ) break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,8 @@ namespace tracy
|
|||||||
enum class QueueType : uint8_t
|
enum class QueueType : uint8_t
|
||||||
{
|
{
|
||||||
ZoneBegin,
|
ZoneBegin,
|
||||||
ZoneEnd
|
ZoneEnd,
|
||||||
|
NUM_TYPES
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack( 1 )
|
#pragma pack( 1 )
|
||||||
@ -47,6 +48,13 @@ struct QueueItem
|
|||||||
|
|
||||||
enum { QueueItemSize = sizeof( 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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user