mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Send initial configuration as a single message.
This commit is contained in:
parent
fce04c6215
commit
7683da5f74
@ -144,15 +144,19 @@ void Profiler::Worker()
|
||||
if( m_sock ) break;
|
||||
}
|
||||
|
||||
m_sock->Send( &m_timeBegin, sizeof( m_timeBegin ) );
|
||||
{
|
||||
WelcomeMessage welcome;
|
||||
#ifdef DISABLE_LZ4
|
||||
// notify client that lz4 compression is disabled (too slow in debug builds)
|
||||
char val = 0;
|
||||
m_sock->Send( &val, 1 );
|
||||
// notify client that lz4 compression is disabled (too slow in debug builds)
|
||||
welcome.lz4 = 0;
|
||||
#else
|
||||
char val = 1;
|
||||
m_sock->Send( &val, 1 );
|
||||
welcome.lz4 = 1;
|
||||
#endif
|
||||
welcome.timeBegin = m_timeBegin;
|
||||
welcome.delay = m_delay;
|
||||
|
||||
m_sock->Send( &welcome, sizeof( welcome ) );
|
||||
}
|
||||
|
||||
LZ4_resetStream( m_stream );
|
||||
|
||||
|
@ -22,6 +22,15 @@ enum ServerQuery : uint8_t
|
||||
ServerQueryThreadString
|
||||
};
|
||||
|
||||
#pragma pack( 1 )
|
||||
struct WelcomeMessage
|
||||
{
|
||||
uint8_t lz4;
|
||||
uint64_t timeBegin;
|
||||
uint64_t delay;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -78,12 +78,15 @@ void View::Worker()
|
||||
|
||||
uint8_t lz4;
|
||||
uint64_t bytes = 0;
|
||||
uint64_t timeStart;
|
||||
|
||||
if( !m_sock.Read( &timeStart, sizeof( timeStart ), &tv, ShouldExit ) ) goto close;
|
||||
if( !m_sock.Read( &lz4, sizeof( lz4 ), &tv, ShouldExit ) ) goto close;
|
||||
{
|
||||
WelcomeMessage welcome;
|
||||
if( !m_sock.Read( &welcome, sizeof( welcome ), &tv, ShouldExit ) ) goto close;
|
||||
lz4 = welcome.lz4;
|
||||
m_frames.push_back( welcome.timeBegin );
|
||||
m_delay = welcome.delay;
|
||||
}
|
||||
|
||||
m_frames.push_back( timeStart );
|
||||
m_hasData.store( true, std::memory_order_release );
|
||||
|
||||
LZ4_setStreamDecode( m_stream, nullptr, 0 );
|
||||
|
@ -115,6 +115,8 @@ private:
|
||||
|
||||
int64_t m_zvStart;
|
||||
int64_t m_zvEnd;
|
||||
|
||||
uint64_t m_delay;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user