mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Send x86 processor info in welcome message.
This commit is contained in:
parent
f13413922d
commit
a47c7d467f
@ -1217,6 +1217,21 @@ void Profiler::Worker()
|
|||||||
uint8_t cpuArch = CpuArchUnknown;
|
uint8_t cpuArch = CpuArchUnknown;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64
|
||||||
|
uint32_t regs[4];
|
||||||
|
char manufacturer[12];
|
||||||
|
CpuId( regs, 0 );
|
||||||
|
memcpy( manufacturer, regs+1, 4 );
|
||||||
|
memcpy( manufacturer+4, regs+3, 4 );
|
||||||
|
memcpy( manufacturer+8, regs+2, 4 );
|
||||||
|
|
||||||
|
CpuId( regs, 1 );
|
||||||
|
uint32_t cpuId = ( regs[0] & 0xFFF ) | ( ( regs[0] & 0xFFF0000 ) >> 4 );
|
||||||
|
#else
|
||||||
|
const char manufacturer[12] = {};
|
||||||
|
uint32_t cpuId = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
WelcomeMessage welcome;
|
WelcomeMessage welcome;
|
||||||
MemWrite( &welcome.timerMul, m_timerMul );
|
MemWrite( &welcome.timerMul, m_timerMul );
|
||||||
MemWrite( &welcome.initBegin, GetInitTime() );
|
MemWrite( &welcome.initBegin, GetInitTime() );
|
||||||
@ -1229,6 +1244,8 @@ void Profiler::Worker()
|
|||||||
MemWrite( &welcome.onDemand, onDemand );
|
MemWrite( &welcome.onDemand, onDemand );
|
||||||
MemWrite( &welcome.isApple, isApple );
|
MemWrite( &welcome.isApple, isApple );
|
||||||
MemWrite( &welcome.cpuArch, cpuArch );
|
MemWrite( &welcome.cpuArch, cpuArch );
|
||||||
|
memcpy( welcome.cpuManufacturer, manufacturer, 12 );
|
||||||
|
MemWrite( &welcome.cpuId, cpuId );
|
||||||
memcpy( welcome.programName, procname, pnsz );
|
memcpy( welcome.programName, procname, pnsz );
|
||||||
memset( welcome.programName + pnsz, 0, WelcomeMessageProgramNameSize - pnsz );
|
memset( welcome.programName + pnsz, 0, WelcomeMessageProgramNameSize - pnsz );
|
||||||
memcpy( welcome.hostInfo, hostinfo, hisz );
|
memcpy( welcome.hostInfo, hostinfo, hisz );
|
||||||
|
@ -9,7 +9,7 @@ namespace tracy
|
|||||||
|
|
||||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||||
|
|
||||||
enum : uint32_t { ProtocolVersion = 30 };
|
enum : uint32_t { ProtocolVersion = 31 };
|
||||||
enum : uint32_t { BroadcastVersion = 1 };
|
enum : uint32_t { BroadcastVersion = 1 };
|
||||||
|
|
||||||
using lz4sz_t = uint32_t;
|
using lz4sz_t = uint32_t;
|
||||||
@ -87,6 +87,8 @@ struct WelcomeMessage
|
|||||||
uint8_t onDemand;
|
uint8_t onDemand;
|
||||||
uint8_t isApple;
|
uint8_t isApple;
|
||||||
uint8_t cpuArch;
|
uint8_t cpuArch;
|
||||||
|
char cpuManufacturer[12];
|
||||||
|
uint32_t cpuId;
|
||||||
char programName[WelcomeMessageProgramNameSize];
|
char programName[WelcomeMessageProgramNameSize];
|
||||||
char hostInfo[WelcomeMessageHostInfoSize];
|
char hostInfo[WelcomeMessageHostInfoSize];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user