From add5b29d03162cae9dca247ff1b8509a7061e59e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 25 Mar 2020 21:28:02 +0100 Subject: [PATCH] Report CPU architecture in welcome message. --- client/TracyProfiler.cpp | 13 +++++++++++++ common/TracyProtocol.hpp | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index fc2c30a7..2e7c8a23 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -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 ); diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 8e58cb61..3b7d3521 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -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]; };