From e92874c0bb770a20ce8e3d1080df70967bbee992 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 4 Mar 2023 00:11:32 +0100 Subject: [PATCH] Save "on demand" flag in traces. Previously on demand mode was determined by frame offset parameter being greater than zero. However, if the application is not pumping frames with FrameMark macro, the frame index will never increase and the frame offset parameter stay at zero. It is not possible to distinguish on demand traces from normal ones in this scenario. Fix by explicitly saving the on demand flag in trace file and employ the previous logic to set the flag when importing older traces. --- public/common/TracyVersion.hpp | 2 +- server/TracyWorker.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/public/common/TracyVersion.hpp b/public/common/TracyVersion.hpp index c82edf93..54b21422 100644 --- a/public/common/TracyVersion.hpp +++ b/public/common/TracyVersion.hpp @@ -7,7 +7,7 @@ namespace Version { enum { Major = 0 }; enum { Minor = 9 }; -enum { Patch = 1 }; +enum { Patch = 2 }; } } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 05b8007b..6c67604d 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -312,6 +312,7 @@ Worker::Worker( const char* name, const char* program, const std::vector= FileVersion( 0, 9, 2 ) ) + { + uint8_t flag; + f.Read( flag ); + m_onDemand = flag; + } + else + { + m_onDemand = m_data.frameOffset != 0; + } + uint64_t sz; { f.Read( sz ); @@ -7656,6 +7668,9 @@ void Worker::Write( FileWrite& f, bool fiDict ) f.Write( &m_data.cpuId, sizeof( m_data.cpuId ) ); f.Write( m_data.cpuManufacturer, 12 ); + uint8_t flag = m_onDemand; + f.Write( &flag, sizeof( flag ) ); + uint64_t sz = m_captureName.size(); f.Write( &sz, sizeof( sz ) ); f.Write( m_captureName.c_str(), sz );