From 50eb5c4b8420bd03e045a9179154c59dcd360a4a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 2 Apr 2018 14:36:07 +0200 Subject: [PATCH] Highlight same zone alloc+free. --- server/TracyView.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 331e2397..4e196789 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3685,6 +3685,14 @@ void View::ListMemData( T ptr, T end, std::function DrawAddress ) ImGui::Text( "Zone alloc" ); ImGui::NextColumn(); ImGui::Text( "Zone free" ); + ImGui::SameLine(); + ImGui::TextDisabled( "(?)" ); + if( ImGui::IsItemHovered() ) + { + ImGui::BeginTooltip(); + ImGui::Text( "If alloc and free is performed in the same zone, it is displayed in yellow color." ); + ImGui::EndTooltip(); + } ImGui::NextColumn(); ImGui::Separator(); int idx = 0; @@ -3747,31 +3755,41 @@ void View::ListMemData( T ptr, T end, std::function DrawAddress ) } else { - auto zone = FindZoneAtTime( m_worker.DecompressThread( v->threadFree ), v->timeFree ); - if( !zone ) + auto zoneFree = FindZoneAtTime( m_worker.DecompressThread( v->threadFree ), v->timeFree ); + if( !zoneFree ) { ImGui::Text( "-" ); } else { - const auto& srcloc = m_worker.GetSourceLocation( zone->srcloc ); + const auto& srcloc = m_worker.GetSourceLocation( zoneFree->srcloc ); const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function ); ImGui::PushID( idx++ ); - auto sel = ImGui::Selectable( txt, false ); + bool sel; + if( zoneFree == zone ) + { + sel = ImGui::Selectable( "", false ); + ImGui::SameLine(); + ImGui::TextColored( ImVec4( 1.f, 1.f, 0.6f, 1.f ), txt ); + } + else + { + sel = ImGui::Selectable( txt, false ); + } auto hover = ImGui::IsItemHovered(); ImGui::PopID(); if( sel ) { - m_zoneInfoWindow = zone; + m_zoneInfoWindow = zoneFree; } if( hover ) { - m_zoneHighlight = zone; + m_zoneHighlight = zoneFree; if( ImGui::IsMouseClicked( 2 ) ) { - ZoomToZone( *zone ); + ZoomToZone( *zoneFree ); } - ZoneTooltip( *zone ); + ZoneTooltip( *zoneFree ); } } }