From 6c5627d8e4a68ae7ae29cf1ea5290b1fb373b455 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 24 Sep 2019 23:58:11 +0200 Subject: [PATCH] Add thread color boxes to memory allocations listings. --- server/TracyView.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 60b4e4ce..a1bf46e4 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -11334,7 +11334,10 @@ void View::ListMemData( T ptr, T end, std::function DrawAddress, const { TextColoredUnformatted( ImVec4( 0.6f, 1.f, 0.6f, 1.f ), TimeToString( m_worker.GetLastTime() - v->TimeAlloc() ) ); ImGui::NextColumn(); - ImGui::TextUnformatted( m_worker.GetThreadName( m_worker.DecompressThread( v->ThreadAlloc() ) ) ); + const auto tid = m_worker.DecompressThread( v->ThreadAlloc() ); + SmallColorBox( GetThreadColor( tid, 0 ) ); + ImGui::SameLine(); + ImGui::TextUnformatted( m_worker.GetThreadName( tid ) ); } else { @@ -11347,11 +11350,24 @@ void View::ListMemData( T ptr, T end, std::function DrawAddress, const ImGui::NextColumn(); if( v->ThreadAlloc() == v->ThreadFree() ) { - ImGui::TextUnformatted( m_worker.GetThreadName( m_worker.DecompressThread( v->ThreadAlloc() ) ) ); + const auto tid = m_worker.DecompressThread( v->ThreadAlloc() ); + SmallColorBox( GetThreadColor( tid, 0 ) ); + ImGui::SameLine(); + ImGui::TextUnformatted( m_worker.GetThreadName( tid ) ); } else { - ImGui::Text( "%s / %s", m_worker.GetThreadName( m_worker.DecompressThread( v->ThreadAlloc() ) ), m_worker.GetThreadName( m_worker.DecompressThread( v->ThreadFree() ) ) ); + const auto tidAlloc = m_worker.DecompressThread( v->ThreadAlloc() ); + const auto tidFree = m_worker.DecompressThread( v->ThreadFree() ); + SmallColorBox( GetThreadColor( tidAlloc, 0 ) ); + ImGui::SameLine(); + ImGui::TextUnformatted( m_worker.GetThreadName( tidAlloc ) ); + ImGui::SameLine(); + ImGui::TextUnformatted( "/" ); + ImGui::SameLine(); + SmallColorBox( GetThreadColor( tidFree, 0 ) ); + ImGui::SameLine(); + ImGui::TextUnformatted( m_worker.GetThreadName( tidFree ) ); } } ImGui::NextColumn();