Add thread color boxes to memory allocations listings.

This commit is contained in:
Bartosz Taudul 2019-09-24 23:58:11 +02:00
parent 581fd920a1
commit 6c5627d8e4

View File

@ -11334,7 +11334,10 @@ void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const
{ {
TextColoredUnformatted( ImVec4( 0.6f, 1.f, 0.6f, 1.f ), TimeToString( m_worker.GetLastTime() - v->TimeAlloc() ) ); TextColoredUnformatted( ImVec4( 0.6f, 1.f, 0.6f, 1.f ), TimeToString( m_worker.GetLastTime() - v->TimeAlloc() ) );
ImGui::NextColumn(); 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 else
{ {
@ -11347,11 +11350,24 @@ void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const
ImGui::NextColumn(); ImGui::NextColumn();
if( v->ThreadAlloc() == v->ThreadFree() ) 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 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(); ImGui::NextColumn();