Add extra parameter to server queries.

This commit is contained in:
Bartosz Taudul 2020-03-25 20:04:01 +01:00
parent 383918bca4
commit 3e0e120222
4 changed files with 9 additions and 6 deletions

View File

@ -2304,10 +2304,12 @@ static bool DontExit() { return false; }
bool Profiler::HandleServerQuery() bool Profiler::HandleServerQuery()
{ {
uint8_t type; uint8_t type;
if( !m_sock->Read( &type, sizeof( type ), 10, DontExit ) ) return false;
uint64_t ptr; uint64_t ptr;
uint32_t extra;
if( !m_sock->Read( &type, sizeof( type ), 10, DontExit ) ) return false;
if( !m_sock->Read( &ptr, sizeof( ptr ), 10, DontExit ) ) return false; if( !m_sock->Read( &ptr, sizeof( ptr ), 10, DontExit ) ) return false;
if( !m_sock->Read( &extra, sizeof( extra ), 10, DontExit ) ) return false;
switch( type ) switch( type )
{ {

View File

@ -55,6 +55,7 @@ struct ServerQueryPacket
{ {
ServerQuery type; ServerQuery type;
uint64_t ptr; uint64_t ptr;
uint32_t extra;
}; };
enum { ServerQueryPacketSize = sizeof( ServerQueryPacket ) }; enum { ServerQueryPacketSize = sizeof( ServerQueryPacket ) };

View File

@ -2790,9 +2790,9 @@ close:
m_connected.store( false, std::memory_order_relaxed ); m_connected.store( false, std::memory_order_relaxed );
} }
void Worker::Query( ServerQuery type, uint64_t data ) void Worker::Query( ServerQuery type, uint64_t data, uint32_t extra )
{ {
ServerQueryPacket query { type, data }; ServerQueryPacket query { type, data, extra };
if( m_serverQuerySpaceLeft > 0 ) if( m_serverQuerySpaceLeft > 0 )
{ {
m_serverQuerySpaceLeft--; m_serverQuerySpaceLeft--;
@ -2806,7 +2806,7 @@ void Worker::Query( ServerQuery type, uint64_t data )
void Worker::QueryTerminate() void Worker::QueryTerminate()
{ {
ServerQueryPacket query { ServerQueryTerminate, 0 }; ServerQueryPacket query { ServerQueryTerminate, 0, 0 };
m_sock.Send( &query, ServerQueryPacketSize ); m_sock.Send( &query, ServerQueryPacketSize );
} }

View File

@ -515,7 +515,7 @@ public:
private: private:
void Network(); void Network();
void Exec(); void Exec();
void Query( ServerQuery type, uint64_t data ); void Query( ServerQuery type, uint64_t data, uint32_t extra = 0 );
void QueryTerminate(); void QueryTerminate();
tracy_force_inline bool DispatchProcess( const QueueItem& ev, const char*& ptr ); tracy_force_inline bool DispatchProcess( const QueueItem& ev, const char*& ptr );