Allow disabling code transfer.

This commit is contained in:
Bartosz Taudul 2020-08-16 01:31:54 +02:00
parent 89786f6e26
commit 5239b706c3
4 changed files with 14 additions and 2 deletions

View File

@ -1265,6 +1265,12 @@ void Profiler::Worker()
uint8_t cpuArch = CpuArchUnknown;
#endif
#ifdef TRACY_NO_CODE_TRANSFER
uint8_t codeTransfer = 0;
#else
uint8_t codeTransfer = 1;
#endif
#if defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64
uint32_t regs[4];
char manufacturer[12];
@ -1292,6 +1298,7 @@ void Profiler::Worker()
MemWrite( &welcome.onDemand, onDemand );
MemWrite( &welcome.isApple, isApple );
MemWrite( &welcome.cpuArch, cpuArch );
MemWrite( &welcome.codeTransfer, codeTransfer );
memcpy( welcome.cpuManufacturer, manufacturer, 12 );
MemWrite( &welcome.cpuId, cpuId );
memcpy( welcome.programName, procname, pnsz );
@ -2481,9 +2488,11 @@ bool Profiler::HandleServerQuery()
case ServerQuerySymbol:
HandleSymbolQuery( ptr );
break;
#ifndef TRACY_NO_CODE_TRANSFER
case ServerQuerySymbolCode:
HandleSymbolCodeQuery( ptr, extra );
break;
#endif
case ServerQueryCodeLocation:
SendCodeLocation( ptr );
break;

View File

@ -9,7 +9,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 39 };
enum : uint32_t { ProtocolVersion = 40 };
enum : uint32_t { BroadcastVersion = 1 };
using lz4sz_t = uint32_t;
@ -87,6 +87,7 @@ struct WelcomeMessage
uint8_t onDemand;
uint8_t isApple;
uint8_t cpuArch;
uint8_t codeTransfer;
char cpuManufacturer[12];
uint32_t cpuId;
char programName[WelcomeMessageProgramNameSize];

View File

@ -2581,6 +2581,7 @@ void Worker::Exec()
m_captureTime = welcome.epoch;
m_ignoreMemFreeFaults = welcome.onDemand || welcome.isApple;
m_data.cpuArch = (CpuArchitecture)welcome.cpuArch;
m_codeTransfer = welcome.codeTransfer;
m_data.cpuId = welcome.cpuId;
memcpy( m_data.cpuManufacturer, welcome.cpuManufacturer, 12 );
m_data.cpuManufacturer[12] = '\0';
@ -5576,7 +5577,7 @@ void Worker::ProcessSymbolInformation( const QueueSymbolInformation& ev )
sd.size.SetVal( it->second.size );
m_data.symbolMap.emplace( ev.symAddr, std::move( sd ) );
if( it->second.size > 0 && it->second.size <= 64*1024 )
if( m_codeTransfer && it->second.size > 0 && it->second.size <= 64*1024 )
{
assert( m_pendingSymbolCode.find( ev.symAddr ) == m_pendingSymbolCode.end() );
m_pendingSymbolCode.emplace( ev.symAddr );

View File

@ -850,6 +850,7 @@ private:
int m_bufferOffset;
bool m_onDemand;
bool m_ignoreMemFreeFaults;
bool m_codeTransfer;
short_ptr<GpuCtxData> m_gpuCtxMap[256];
uint64_t m_pendingCallstackPtr = 0;