Report CPU architecture in welcome message.

This commit is contained in:
Bartosz Taudul 2020-03-25 21:28:02 +01:00
parent 5a3dedea97
commit add5b29d03
2 changed files with 24 additions and 0 deletions

View File

@ -1210,6 +1210,18 @@ void Profiler::Worker()
uint8_t isApple = 0;
#endif
#if defined __i386 || defined _M_IX86
uint8_t cpuArch = CpuArchX86;
#elif defined __x86_64__ || defined _M_X64
uint8_t cpuArch = CpuArchX64;
#elif defined __aarch64__
uint8_t cpuArch = CpuArchArm64;
#elif defined __ARM_ARCH
uint8_t cpuArch = CpuArchArm32;
#else
uint8_t cpuArch = CpuArchUnknown;
#endif
WelcomeMessage welcome;
MemWrite( &welcome.timerMul, m_timerMul );
MemWrite( &welcome.initBegin, GetInitTime() );
@ -1221,6 +1233,7 @@ void Profiler::Worker()
MemWrite( &welcome.samplingPeriod, m_samplingPeriod );
MemWrite( &welcome.onDemand, onDemand );
MemWrite( &welcome.isApple, isApple );
MemWrite( &welcome.cpuArch, cpuArch );
memcpy( welcome.programName, procname, pnsz );
memset( welcome.programName + pnsz, 0, WelcomeMessageProgramNameSize - pnsz );
memcpy( welcome.hostInfo, hostinfo, hisz );

View File

@ -63,6 +63,16 @@ struct ServerQueryPacket
enum { ServerQueryPacketSize = sizeof( ServerQueryPacket ) };
enum CpuArchitecture : uint8_t
{
CpuArchUnknown,
CpuArchX86,
CpuArchX64,
CpuArchArm32,
CpuArchArm64
};
struct WelcomeMessage
{
double timerMul;
@ -75,6 +85,7 @@ struct WelcomeMessage
int64_t samplingPeriod;
uint8_t onDemand;
uint8_t isApple;
uint8_t cpuArch;
char programName[WelcomeMessageProgramNameSize];
char hostInfo[WelcomeMessageHostInfoSize];
};