1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Define server query packet.

This commit is contained in:
Bartosz Taudul
2019-04-01 18:52:32 +02:00
parent 57cd6d3ed5
commit c07c6d11b7
3 changed files with 34 additions and 28 deletions
+13 -16
View File
@@ -1800,7 +1800,7 @@ void Worker::Exec()
}
if( !done ) continue;
}
ServerQuery( ServerQueryTerminate, 0 );
Query( ServerQueryTerminate, 0 );
break;
}
}
@@ -1810,13 +1810,10 @@ close:
m_connected.store( false, std::memory_order_relaxed );
}
void Worker::ServerQuery( uint8_t type, uint64_t data )
void Worker::Query( ServerQuery type, uint64_t data )
{
enum { DataSize = sizeof( type ) + sizeof( data ) };
char tmp[DataSize];
memcpy( tmp, &type, sizeof( type ) );
memcpy( tmp + sizeof( type ), &data, sizeof( data ) );
m_sock.Send( tmp, DataSize );
ServerQueryPacket query = { type, data };
m_sock.Send( &query, ServerQueryPacketSize );
}
bool Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
@@ -1883,7 +1880,7 @@ void Worker::NewSourceLocation( uint64_t ptr )
m_pendingSourceLocation++;
m_sourceLocationQueue.push_back( ptr );
ServerQuery( ServerQuerySourceLocation, ptr );
Query( ServerQuerySourceLocation, ptr );
}
uint32_t Worker::ShrinkSourceLocation( uint64_t srcloc )
@@ -2067,7 +2064,7 @@ void Worker::CheckString( uint64_t ptr )
m_data.strings.emplace( ptr, "???" );
m_pendingStrings++;
ServerQuery( ServerQueryString, ptr );
Query( ServerQueryString, ptr );
}
void Worker::CheckThreadString( uint64_t id )
@@ -2077,7 +2074,7 @@ void Worker::CheckThreadString( uint64_t id )
m_data.threadNames.emplace( id, "???" );
m_pendingThreads++;
ServerQuery( ServerQueryThreadString, id );
Query( ServerQueryThreadString, id );
}
void Worker::AddSourceLocation( const QueueSourceLocation& srcloc )
@@ -2211,7 +2208,7 @@ void Worker::AddCallstackPayload( uint64_t ptr, char* _data, size_t _sz )
if( fit == m_data.callstackFrameMap.end() )
{
m_pendingCallstackFrames++;
ServerQuery( ServerQueryCallstackFrame, GetCanonicalPointer( frame ) );
Query( ServerQueryCallstackFrame, GetCanonicalPointer( frame ) );
}
}
}
@@ -2290,7 +2287,7 @@ void Worker::AddCallstackAllocPayload( uint64_t ptr, char* data, size_t _sz )
if( fit == m_data.callstackFrameMap.end() )
{
m_pendingCallstackFrames++;
ServerQuery( ServerQueryCallstackFrame, GetCanonicalPointer( frame ) );
Query( ServerQueryCallstackFrame, GetCanonicalPointer( frame ) );
}
}
}
@@ -2738,7 +2735,7 @@ void Worker::ProcessFrameMark( const QueueFrameMark& ev )
fd->continuous = 1;
return fd;
}, [this] ( uint64_t name ) {
ServerQuery( ServerQueryFrameName, name );
Query( ServerQueryFrameName, name );
} );
assert( fd->continuous == 1 );
@@ -2756,7 +2753,7 @@ void Worker::ProcessFrameMarkStart( const QueueFrameMark& ev )
fd->continuous = 0;
return fd;
}, [this] ( uint64_t name ) {
ServerQuery( ServerQueryFrameName, name );
Query( ServerQueryFrameName, name );
} );
assert( fd->continuous == 0 );
@@ -2774,7 +2771,7 @@ void Worker::ProcessFrameMarkEnd( const QueueFrameMark& ev )
fd->continuous = 0;
return fd;
}, [this] ( uint64_t name ) {
ServerQuery( ServerQueryFrameName, name );
Query( ServerQueryFrameName, name );
} );
assert( fd->continuous == 0 );
@@ -3006,7 +3003,7 @@ void Worker::ProcessPlotData( const QueuePlotData& ev )
plot->type = PlotType::User;
return plot;
}, [this]( uint64_t name ) {
ServerQuery( ServerQueryPlotName, name );
Query( ServerQueryPlotName, name );
} );
const auto time = TscTime( ev.time );