Callstack payload transfer.

This commit is contained in:
Bartosz Taudul 2018-06-19 19:09:43 +02:00
parent 55e6a4a484
commit 51043ebc47
3 changed files with 28 additions and 0 deletions

View File

@ -520,6 +520,31 @@ void Profiler::SendSourceLocationPayload( uint64_t _ptr )
AppendData( ptr + 4, l16 ); AppendData( ptr + 4, l16 );
} }
void Profiler::SendCallstackPayload( uint64_t _ptr )
{
auto ptr = (uintptr_t*)_ptr;
QueueItem item;
MemWrite( &item.hdr.type, QueueType::CallstackPayload );
MemWrite( &item.stringTransfer.ptr, _ptr );
const auto sz = *ptr++;
const auto len = sz * sizeof( uint64_t );
const auto l16 = uint16_t( len );
NeedDataSize( QueueDataSize[(int)QueueType::CallstackPayload] + sizeof( l16 ) + l16 );
AppendData( &item, QueueDataSize[(int)QueueType::CallstackPayload] );
AppendData( &l16, sizeof( l16 ) );
for( uintptr_t i=0; i<sz; i++ )
{
const auto val = uint64_t( *ptr++ );
AppendData( &val, sizeof( uint64_t ) );
}
}
static bool DontExit() { return false; } static bool DontExit() { return false; }
bool Profiler::HandleServerQuery() bool Profiler::HandleServerQuery()

View File

@ -298,6 +298,7 @@ private:
void SendString( uint64_t ptr, const char* str, QueueType type ); void SendString( uint64_t ptr, const char* str, QueueType type );
void SendSourceLocation( uint64_t ptr ); void SendSourceLocation( uint64_t ptr );
void SendSourceLocationPayload( uint64_t ptr ); void SendSourceLocationPayload( uint64_t ptr );
void SendCallstackPayload( uint64_t ptr );
bool HandleServerQuery(); bool HandleServerQuery();

View File

@ -41,6 +41,7 @@ enum class QueueType : uint8_t
CustomStringData, CustomStringData,
PlotName, PlotName,
SourceLocationPayload, SourceLocationPayload,
CallstackPayload,
NUM_TYPES NUM_TYPES
}; };
@ -292,6 +293,7 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // custom string data sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // custom string data
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack payload
}; };
static_assert( QueueItemSize == 32, "Queue item size not 32 bytes" ); static_assert( QueueItemSize == 32, "Queue item size not 32 bytes" );