mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Delta-encode code information pointers.
This commit is contained in:
parent
b099df75c2
commit
a1511a39bd
@ -3464,11 +3464,12 @@ void Profiler::SendCodeLocation( uint64_t ptr )
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
const auto sym = DecodeCodeAddress( ptr );
|
||||
|
||||
const uint64_t offset = ptr - sym.symAddr;
|
||||
SendSingleString( sym.file );
|
||||
|
||||
QueueItem item;
|
||||
MemWrite( &item.hdr.type, QueueType::CodeInformation );
|
||||
MemWrite( &item.codeInformation.ptr, ptr );
|
||||
MemWrite( &item.codeInformation.ptrOffset, offset );
|
||||
MemWrite( &item.codeInformation.line, sym.line );
|
||||
MemWrite( &item.codeInformation.symAddr, sym.symAddr );
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace tracy
|
||||
|
||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||
|
||||
enum : uint32_t { ProtocolVersion = 49 };
|
||||
enum : uint32_t { ProtocolVersion = 50 };
|
||||
enum : uint16_t { BroadcastVersion = 2 };
|
||||
|
||||
using lz4sz_t = uint32_t;
|
||||
|
@ -501,9 +501,9 @@ struct QueueSymbolInformation
|
||||
|
||||
struct QueueCodeInformation
|
||||
{
|
||||
uint64_t ptr;
|
||||
uint32_t line;
|
||||
uint64_t symAddr;
|
||||
uint32_t line;
|
||||
uint64_t ptrOffset;
|
||||
};
|
||||
|
||||
struct QueueCrashReport
|
||||
|
@ -6344,22 +6344,23 @@ void Worker::ProcessCodeInformation( const QueueCodeInformation& ev )
|
||||
m_pendingCodeInformation--;
|
||||
|
||||
const auto idx = GetSingleStringIdx();
|
||||
const uint64_t ptr = ev.symAddr + ev.ptrOffset;
|
||||
|
||||
if( ev.line != 0 )
|
||||
{
|
||||
assert( m_data.codeAddressToLocation.find( ev.ptr ) == m_data.codeAddressToLocation.end() );
|
||||
assert( m_data.codeAddressToLocation.find( ptr ) == m_data.codeAddressToLocation.end() );
|
||||
const auto packed = PackFileLine( idx, ev.line );
|
||||
m_data.codeAddressToLocation.emplace( ev.ptr, packed );
|
||||
m_data.codeAddressToLocation.emplace( ptr, packed );
|
||||
|
||||
auto lit = m_data.locationCodeAddressList.find( packed );
|
||||
if( lit == m_data.locationCodeAddressList.end() )
|
||||
{
|
||||
m_data.locationCodeAddressList.emplace( packed, Vector<uint64_t>( ev.ptr ) );
|
||||
m_data.locationCodeAddressList.emplace( packed, Vector<uint64_t>( ptr ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool needSort = lit->second.back() > ev.ptr;
|
||||
lit->second.push_back( ev.ptr );
|
||||
const bool needSort = lit->second.back() > ptr;
|
||||
lit->second.push_back( ptr );
|
||||
if( needSort ) pdqsort_branchless( lit->second.begin(), lit->second.end() );
|
||||
}
|
||||
|
||||
@ -6369,8 +6370,8 @@ void Worker::ProcessCodeInformation( const QueueCodeInformation& ev )
|
||||
}
|
||||
if( ev.symAddr != 0 )
|
||||
{
|
||||
assert( m_data.codeSymbolMap.find( ev.ptr ) == m_data.codeSymbolMap.end() );
|
||||
m_data.codeSymbolMap.emplace( ev.ptr, ev.symAddr );
|
||||
assert( m_data.codeSymbolMap.find( ptr ) == m_data.codeSymbolMap.end() );
|
||||
m_data.codeSymbolMap.emplace( ptr, ev.symAddr );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user