From 9c2aab733db24605a8260e6eef876deed4e48caa Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 22 Jun 2018 20:32:38 +0200 Subject: [PATCH] Allow centering timeline on memory alloc/free time. --- server/TracyView.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index fde0b4c5..a967b072 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4885,6 +4885,14 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd ImGui::Text( "Size" ); ImGui::NextColumn(); ImGui::Text( "Appeared at" ); + ImGui::SameLine(); + ImGui::TextDisabled( "(?)" ); + if( ImGui::IsItemHovered() ) + { + ImGui::BeginTooltip(); + ImGui::Text( "Click on entry to center timeline at the memory allocation time." ); + ImGui::EndTooltip(); + } ImGui::NextColumn(); ImGui::Text( "Duration" ); ImGui::SameLine(); @@ -4893,9 +4901,9 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd { ImGui::BeginTooltip(); ImGui::Text( "Active allocations are displayed using green color." ); + ImGui::Text( "Click on entry to center timeline at the memory release time." ); ImGui::EndTooltip(); } - ImGui::NextColumn(); ImGui::Text( "Thread" ); ImGui::SameLine(); @@ -4930,7 +4938,12 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd ImGui::NextColumn(); ImGui::Text( "%s", RealToString( v->size, true ) ); ImGui::NextColumn(); - ImGui::Text( "%s", TimeToString( v->timeAlloc - m_worker.GetFrameBegin( 0 ) ) ); + ImGui::PushID( idx++ ); + if( ImGui::Selectable( TimeToString( v->timeAlloc - m_worker.GetFrameBegin( 0 ) ) ) ) + { + CenterAtTime( v->timeAlloc ); + } + ImGui::PopID(); ImGui::NextColumn(); if( v->timeFree < 0 ) { @@ -4940,7 +4953,12 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd } else { - ImGui::Text( "%s", TimeToString( v->timeFree - v->timeAlloc ) ); + ImGui::PushID( idx++ ); + if( ImGui::Selectable( TimeToString( v->timeFree - v->timeAlloc ) ) ) + { + CenterAtTime( v->timeFree ); + } + ImGui::PopID(); ImGui::NextColumn(); if( v->threadAlloc == v->threadFree ) {