From 4000f27e15ab343c612e4d198378677e6d090539 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 20 Jun 2018 01:18:59 +0200 Subject: [PATCH] Stack frame accessor. --- server/TracyWorker.cpp | 13 +++++++++++++ server/TracyWorker.hpp | 2 ++ 2 files changed, 15 insertions(+) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index eba67b79..d37b3769 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -721,6 +721,19 @@ std::pair Worker::GetFrameRange( int64_t from, int64_t to ) return std::make_pair( zbegin, zend ); } +const CallstackFrame* Worker::GetCallstackFrame( uint64_t ptr ) +{ + auto it = m_data.callstackFrameMap.find( ptr ); + if( it == m_data.callstackFrameMap.end() ) + { + return nullptr; + } + else + { + return it->second; + } +} + int64_t Worker::GetZoneEnd( const ZoneEvent& ev ) { auto ptr = &ev; diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index aef69417..d3e46dc6 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -145,7 +145,9 @@ public: const Vector& GetPlots() const { return m_data.plots; } const Vector& GetThreadData() const { return m_data.threads; } const MemData& GetMemData() const { return m_data.memory; } + const VarArray& GetCallstack( uint32_t idx ) { return *m_data.callstackPayload[idx]; } + const CallstackFrame* GetCallstackFrame( uint64_t ptr ); // 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