From d2cca5dc3fcc7e28daf89f4d06a0767703a426f2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 17 Mar 2019 16:47:44 +0100 Subject: [PATCH] Allow custom time offset in memory allocation list. --- server/TracyView.cpp | 6 ++++-- server/TracyView.hpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 9e4957a1..28fe84aa 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8653,8 +8653,10 @@ void View::DrawLockInfoWindow() } template -void View::ListMemData( T ptr, T end, std::function DrawAddress, const char* id ) +void View::ListMemData( T ptr, T end, std::function DrawAddress, const char* id, int64_t startTime ) { + if( startTime == -1 ) startTime = m_worker.GetTimeBegin(); + const auto& style = ImGui::GetStyle(); const auto dist = std::distance( ptr, end ) + 1; const auto ty = ImGui::GetTextLineHeight() + style.ItemSpacing.y; @@ -8724,7 +8726,7 @@ void View::ListMemData( T ptr, T end, std::function DrawAddress, const ImGui::TextUnformatted( MemSizeToString( v->size ) ); ImGui::NextColumn(); ImGui::PushID( idx++ ); - if( ImGui::Selectable( TimeToString( v->timeAlloc - m_worker.GetTimeBegin() ) ) ) + if( ImGui::Selectable( TimeToString( v->timeAlloc - startTime ) ) ) { CenterAtTime( v->timeAlloc ); } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 46c4b4e8..2cb848fa 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -125,7 +125,7 @@ private: void DrawLockInfoWindow(); template - void ListMemData( T ptr, T end, std::function DrawAddress, const char* id = nullptr ); + void ListMemData( T ptr, T end, std::function DrawAddress, const char* id = nullptr, int64_t startTime = -1 ); flat_hash_map> GetCallstackPaths( const MemData& mem ) const; std::vector GetCallstackFrameTreeBottomUp( const MemData& mem ) const;