1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Sort active allocations by appearance time.

This commit is contained in:
Bartosz Taudul 2018-04-02 15:45:11 +02:00
parent 38edf308fa
commit c1aaec32d6

View File

@ -3870,9 +3870,17 @@ void View::DrawMemory()
ImGui::Separator();
if( ImGui::TreeNode( "Active allocations" ) )
{
ListMemData<decltype( mem.active.begin() )>( mem.active.begin(), mem.active.end(), []( auto& v ) {
ImGui::Text( "0x%" PRIx64, v->second->ptr );
return v->second;
std::vector<MemEvent*> items;
items.reserve( mem.active.size() );
for( auto& v : mem.active )
{
items.emplace_back( v.second );
}
std::sort( items.begin(), items.end(), []( const auto& lhs, const auto& rhs ) { return lhs->timeAlloc > rhs->timeAlloc; } );
ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) {
ImGui::Text( "0x%" PRIx64, (*v)->ptr );
return *v;
} );
ImGui::TreePop();
}