From e6b3f373c5b49447e7d69c3842655c2827f10f21 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 18 Mar 2018 02:53:00 +0100 Subject: [PATCH] Add direct zone end getter. --- server/TracyWorker.cpp | 10 ++++++++++ server/TracyWorker.hpp | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 1856a06e..b0264789 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -308,6 +308,16 @@ int64_t Worker::GetZoneEnd( const GpuEvent& ev ) const } } +int64_t Worker::GetZoneEndDirect( const ZoneEvent& ev ) const +{ + return ev.end != -1 ? ev.end : ev.start; +} + +int64_t Worker::GetZoneEndDirect( const GpuEvent& ev ) const +{ + return ev.gpuEnd != -1 ? ev.gpuEnd : ev.gpuStart; +} + const char* Worker::GetString( uint64_t ptr ) const { const auto it = m_data.strings.find( ptr ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 687d645c..f5a34cc1 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -94,8 +94,15 @@ public: const Vector& GetPlots() const { return m_data.plots; } const Vector& GetThreadData() const { return m_data.threads; } + // Some zones may have incomplete timing data (only start time is available, end hasn't arrived yet). + // GetZoneEnd() will try to infer the end time by looking at child zones (parent zone can't end + // before its children have ended). + // GetZoneEndDirect() will only return zone's direct timing data, without looking at children. int64_t GetZoneEnd( const ZoneEvent& ev ) const; int64_t GetZoneEnd( const GpuEvent& ev ) const; + int64_t GetZoneEndDirect( const ZoneEvent& ev ) const; + int64_t GetZoneEndDirect( const GpuEvent& ev ) const; + const char* GetString( uint64_t ptr ) const; const char* GetString( const StringRef& ref ) const; const char* GetString( const StringIdx& idx ) const;