Display zone if which allocation was freed.

This commit is contained in:
Bartosz Taudul 2018-04-02 14:29:56 +02:00
parent e1682c7675
commit f7ce3e795f

View File

@ -3653,7 +3653,7 @@ void View::DrawStatistics()
template<class T> template<class T>
void View::ListMemData( T ptr, T end, std::function<MemEvent*(T&)> DrawAddress ) void View::ListMemData( T ptr, T end, std::function<MemEvent*(T&)> DrawAddress )
{ {
ImGui::Columns( 6 ); ImGui::Columns( 7 );
ImGui::Text( "Address" ); ImGui::Text( "Address" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "Size" ); ImGui::Text( "Size" );
@ -3682,7 +3682,9 @@ void View::ListMemData( T ptr, T end, std::function<MemEvent*(T&)> DrawAddress )
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "Zone" ); ImGui::Text( "Zone alloc" );
ImGui::NextColumn();
ImGui::Text( "Zone free" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator(); ImGui::Separator();
int idx = 0; int idx = 0;
@ -3723,8 +3725,6 @@ void View::ListMemData( T ptr, T end, std::function<MemEvent*(T&)> DrawAddress )
ImGui::PushID( idx++ ); ImGui::PushID( idx++ );
auto sel = ImGui::Selectable( txt, false ); auto sel = ImGui::Selectable( txt, false );
auto hover = ImGui::IsItemHovered(); auto hover = ImGui::IsItemHovered();
ImGui::SameLine();
ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
ImGui::PopID(); ImGui::PopID();
if( sel ) if( sel )
{ {
@ -3741,6 +3741,41 @@ void View::ListMemData( T ptr, T end, std::function<MemEvent*(T&)> DrawAddress )
} }
} }
ImGui::NextColumn(); ImGui::NextColumn();
if( v->timeFree < 0 )
{
ImGui::TextColored( ImVec4( 0.6f, 1.f, 0.6f, 1.f ), "active" );
}
else
{
auto zone = FindZoneAtTime( m_worker.DecompressThread( v->threadFree ), v->timeFree );
if( !zone )
{
ImGui::Text( "-" );
}
else
{
const auto& srcloc = m_worker.GetSourceLocation( zone->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 );
auto hover = ImGui::IsItemHovered();
ImGui::PopID();
if( sel )
{
m_zoneInfoWindow = zone;
}
if( hover )
{
m_zoneHighlight = zone;
if( ImGui::IsMouseClicked( 2 ) )
{
ZoomToZone( *zone );
}
ZoneTooltip( *zone );
}
}
}
ImGui::NextColumn();
ptr++; ptr++;
} }
ImGui::EndColumns(); ImGui::EndColumns();