From 880c6005063a47a94f8b17240af8671fefc37592 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 11 Jul 2025 23:19:22 +0200 Subject: [PATCH] Remove queue delay calibration. This value is not used for anything, it was just a number displayed in the UI without much meaning to anyone. Operations on the queue during early init may not work correctly, stopping some programs from running past the calibration loop. --- capture/src/capture.cpp | 2 +- manual/tracy.tex | 3 +- profiler/src/profiler/TracyView_TraceInfo.cpp | 1 - public/client/TracyProfiler.cpp | 38 ------------------- public/client/TracyProfiler.hpp | 1 - public/common/TracyProtocol.hpp | 3 +- public/common/TracyVersion.hpp | 2 +- server/TracyWorker.cpp | 9 ++--- server/TracyWorker.hpp | 2 - 9 files changed, 8 insertions(+), 53 deletions(-) diff --git a/capture/src/capture.cpp b/capture/src/capture.cpp index ff833f73..16293ef5 100644 --- a/capture/src/capture.cpp +++ b/capture/src/capture.cpp @@ -185,7 +185,7 @@ int main( int argc, char** argv ) } std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); } - printf( "\nQueue delay: %s\nTimer resolution: %s\n", tracy::TimeToString( worker.GetDelay() ), tracy::TimeToString( worker.GetResolution() ) ); + printf( "\nTimer resolution: %s\n", tracy::TimeToString( worker.GetResolution() ) ); #ifdef _WIN32 signal( SIGINT, SigInt ); diff --git a/manual/tracy.tex b/manual/tracy.tex index 7b645833..90a9d3e7 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -2854,12 +2854,11 @@ If no client is running at the given address, the server will wait until it can \begin{verbatim} % ./capture -a 127.0.0.1 -o trace Connecting to 127.0.0.1:8086... -Queue delay: 5 ns Timer resolution: 3 ns 1.33 Mbps / 40.4% = 3.29 Mbps | Net: 64.42 MB | Mem: 283.03 MB | Time: 10.6 s \end{verbatim} -The \emph{queue delay} and \emph{timer resolution} parameters are calibration results of timers used by the client. The following line is a status bar, which displays: network connection speed, connection compression ratio, and the resulting uncompressed data rate; the total amount of data transferred over the network; memory usage of the capture utility; time extent of the captured data. +The \emph{timer resolution} parameter shows the calibration results of timers used by the client. The following line is a status bar, which displays: network connection speed, connection compression ratio, and the resulting uncompressed data rate; the total amount of data transferred over the network; memory usage of the capture utility; time extent of the captured data. You can disconnect from the client and save the captured trace by pressing \keys{\ctrl + C}. If you prefer to disconnect after a fixed time, use the \texttt{-s seconds} parameter. diff --git a/profiler/src/profiler/TracyView_TraceInfo.cpp b/profiler/src/profiler/TracyView_TraceInfo.cpp index 7a312af8..465c8031 100644 --- a/profiler/src/profiler/TracyView_TraceInfo.cpp +++ b/profiler/src/profiler/TracyView_TraceInfo.cpp @@ -76,7 +76,6 @@ void View::DrawInfo() ImGui::SameLine(); const auto version = m_worker.GetTraceVersion(); ImGui::Text( "%i.%i.%i", version >> 16, ( version >> 8 ) & 0xFF, version & 0xFF ); - TextFocused( "Queue delay:", TimeToString( m_worker.GetDelay() ) ); TextFocused( "Timer resolution:", TimeToString( m_worker.GetResolution() ) ); TextFocused( "CPU zones:", RealToString( m_worker.GetZoneCount() ) ); ImGui::SameLine(); diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index 22830765..e2e0747b 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -1771,7 +1771,6 @@ void Profiler::Worker() MemWrite( &welcome.timerMul, m_timerMul ); MemWrite( &welcome.initBegin, GetInitTime() ); MemWrite( &welcome.initEnd, m_timeBegin.load( std::memory_order_relaxed ) ); - MemWrite( &welcome.delay, m_delay ); MemWrite( &welcome.resolution, m_resolution ); MemWrite( &welcome.epoch, m_epoch ); MemWrite( &welcome.exectime, m_exectime ); @@ -3811,43 +3810,6 @@ void Profiler::CalibrateDelay() if( dti > 0 && dti < mindiff ) mindiff = dti; } m_resolution = mindiff; - -#ifdef TRACY_DELAYED_INIT - m_delay = m_resolution; -#else - constexpr int Events = Iterations * 2; // start + end - static_assert( Events < QueuePrealloc, "Delay calibration loop will allocate memory in queue" ); - - static const tracy::SourceLocationData __tracy_source_location { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; - const auto t0 = GetTime(); - for( int i=0; izoneBegin.time, Profiler::GetTime() ); - MemWrite( &item->zoneBegin.srcloc, (uint64_t)&__tracy_source_location ); - TracyLfqCommit; - } - { - TracyLfqPrepare( QueueType::ZoneEnd ); - MemWrite( &item->zoneEnd.time, GetTime() ); - TracyLfqCommit; - } - } - const auto t1 = GetTime(); - const auto dt = t1 - t0; - m_delay = dt / Events; - - moodycamel::ConsumerToken token( GetQueue() ); - int left = Events; - while( left != 0 ) - { - const auto sz = GetQueue().try_dequeue_bulk_single( token, [](const uint64_t&){}, [](QueueItem* item, size_t sz){} ); - assert( sz > 0 ); - left -= (int)sz; - } - assert( GetQueue().size_approx() == 0 ); -#endif } void Profiler::ReportTopology() diff --git a/public/client/TracyProfiler.hpp b/public/client/TracyProfiler.hpp index 8d169058..e773f5ec 100644 --- a/public/client/TracyProfiler.hpp +++ b/public/client/TracyProfiler.hpp @@ -991,7 +991,6 @@ private: double m_timerMul; uint64_t m_resolution; - uint64_t m_delay; std::atomic m_timeBegin; uint32_t m_mainThread; uint64_t m_epoch, m_exectime; diff --git a/public/common/TracyProtocol.hpp b/public/common/TracyProtocol.hpp index 40cf5e67..d23b1d08 100644 --- a/public/common/TracyProtocol.hpp +++ b/public/common/TracyProtocol.hpp @@ -9,7 +9,7 @@ namespace tracy constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; } -enum : uint32_t { ProtocolVersion = 74 }; +enum : uint32_t { ProtocolVersion = 75 }; enum : uint16_t { BroadcastVersion = 3 }; using lz4sz_t = uint32_t; @@ -95,7 +95,6 @@ struct WelcomeMessage double timerMul; int64_t initBegin; int64_t initEnd; - uint64_t delay; uint64_t resolution; uint64_t epoch; uint64_t exectime; diff --git a/public/common/TracyVersion.hpp b/public/common/TracyVersion.hpp index 93b6737e..6da3a6f6 100644 --- a/public/common/TracyVersion.hpp +++ b/public/common/TracyVersion.hpp @@ -7,7 +7,7 @@ namespace Version { enum { Major = 0 }; enum { Minor = 12 }; -enum { Patch = 2 }; +enum { Patch = 3 }; } } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index fd76a016..e7f76961 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -301,7 +301,6 @@ Worker::Worker( const char* addr, uint16_t port, int64_t memoryLimit ) Worker::Worker( const char* name, const char* program, const std::vector& timeline, const std::vector& messages, const std::vector& plots, const std::unordered_map& threadNames ) : m_hasData( true ) - , m_delay( 0 ) , m_resolution( 0 ) , m_captureName( name ) , m_captureProgram( program ) @@ -576,8 +575,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow { throw LegacyVersion( fileVer ); } - - f.Read( m_delay ); + if( fileVer < FileVersion( 0, 12, 3 ) ) + { + f.Skip( 8 ); // m_delay + } } else { @@ -2757,7 +2758,6 @@ void Worker::Exec() m_data.framesBase->frames.push_back( FrameEvent{ 0, -1, -1 } ); m_data.framesBase->frames.push_back( FrameEvent{ initEnd, -1, -1 } ); m_data.lastTime = initEnd; - m_delay = TscPeriod( welcome.delay ); m_resolution = TscPeriod( welcome.resolution ); m_pid = welcome.pid; m_samplingPeriod = welcome.samplingPeriod; @@ -7820,7 +7820,6 @@ void Worker::Write( FileWrite& f, bool fiDict ) f.Write( FileHeader, sizeof( FileHeader ) ); - f.Write( &m_delay, sizeof( m_delay ) ); f.Write( &m_resolution, sizeof( m_resolution ) ); f.Write( &m_timerMul, sizeof( m_timerMul ) ); f.Write( &m_data.lastTime, sizeof( m_data.lastTime ) ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index f0721041..f95d5ba7 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -465,7 +465,6 @@ public: uint64_t GetCaptureTime() const { return m_captureTime; } uint64_t GetExecutableTime() const { return m_executableTime; } const std::string& GetHostInfo() const { return m_hostInfo; } - int64_t GetDelay() const { return m_delay; } int64_t GetResolution() const { return m_resolution; } uint64_t GetPid() const { return m_pid; }; CpuArchitecture GetCpuArch() const { return m_data.cpuArch; } @@ -982,7 +981,6 @@ private: std::atomic m_backgroundDone { true }; std::thread m_threadBackground; - int64_t m_delay; int64_t m_resolution; double m_timerMul; std::string m_captureName;