From 20f8c8b8a45616ae1cadeb10625f37ca4cacd47c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 4 Dec 2021 14:50:25 +0100 Subject: [PATCH] Add IdentifySamples flag to the protocol. On Windows there is no way to distinguish callstack data coming from random sampling and from context switches. Each callstack timestamp has to be matched against the context switch data in order to decide its origin. This is obviously non-trivial. On some other platforms, the origin information may be available right away, in which case the process of matching against the context switch data, which possibly includes postponing callstacks for processing in the future, may be completely omitted. --- client/TracyProfiler.cpp | 1 + common/TracyProtocol.hpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 6f6cd167..c1d33d1c 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1540,6 +1540,7 @@ void Profiler::Worker() #endif #ifdef _WIN32 flags |= WelcomeFlag::CombineSamples; + flags |= WelcomeFlag::IdentifySamples; #endif #if defined __i386 || defined _M_IX86 diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index e7ab86ad..1cd46346 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -9,7 +9,7 @@ namespace tracy constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } -enum : uint32_t { ProtocolVersion = 53 }; +enum : uint32_t { ProtocolVersion = 54 }; enum : uint16_t { BroadcastVersion = 2 }; using lz4sz_t = uint32_t; @@ -86,6 +86,7 @@ struct WelcomeFlag IsApple = 1 << 1, CodeTransfer = 1 << 2, CombineSamples = 1 << 3, + IdentifySamples = 1 << 4, }; };