1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Merge pull request #724 from idbrii/fix-mem-callstacktree-active

Memory: correctly filter active allocations in call stack tree
This commit is contained in:
Bartosz Taudul 2024-02-15 20:12:22 +01:00 committed by GitHub
commit 5ce238e9b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,6 +58,8 @@ unordered_flat_map<uint32_t, View::MemPathData> View::GetCallstackPaths( const M
unordered_flat_map<uint32_t, MemPathData> pathSum;
pathSum.reserve( m_worker.GetCallstackPayloadCount() );
const bool hide_inactive = memRange == MemRange::Active;
if( m_memInfo.range.active )
{
auto it = std::lower_bound( mem.data.begin(), mem.data.end(), m_memInfo.range.min, []( const auto& lhs, const auto& rhs ) { return lhs.TimeAlloc() < rhs; } );
@ -70,7 +72,8 @@ unordered_flat_map<uint32_t, View::MemPathData> View::GetCallstackPaths( const M
{
auto& ev = *it++;
if( ev.CsAlloc() == 0 ) continue;
if( ( memRange == MemRange::Inactive ) == ( ev.TimeFree() >= 0 && ev.TimeFree() < m_memInfo.range.max ) ) continue;
const bool is_inactive = ev.TimeFree() >= 0 && ev.TimeFree() < m_memInfo.range.max;
if( hide_inactive == is_inactive ) continue;
auto pit = pathSum.find( ev.CsAlloc() );
if( pit == pathSum.end() )
{
@ -110,7 +113,8 @@ unordered_flat_map<uint32_t, View::MemPathData> View::GetCallstackPaths( const M
for( auto& ev : mem.data )
{
if( ev.CsAlloc() == 0 ) continue;
if( ( memRange == MemRange::Inactive ) == ( ev.TimeFree() >= 0 ) ) continue;
const bool is_inactive = ev.TimeFree() >= 0;
if( hide_inactive == is_inactive ) continue;
auto it = pathSum.find( ev.CsAlloc() );
if( it == pathSum.end() )
{