mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Also calculate sample parents without inlines.
This commit is contained in:
parent
687d4defc0
commit
d8a611e952
@ -828,6 +828,7 @@ struct SymbolStats
|
||||
{
|
||||
uint32_t incl, excl;
|
||||
unordered_flat_map<uint32_t, uint32_t> parents;
|
||||
unordered_flat_map<uint32_t, uint32_t> baseParents;
|
||||
};
|
||||
|
||||
enum { SymbolStatsSize = sizeof( SymbolStats ) };
|
||||
|
@ -7386,6 +7386,8 @@ void Worker::UpdateSampleStatisticsImpl( const CallstackFrameData** frames, uint
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t parentIdx;
|
||||
{
|
||||
const auto sz = framesCount - ( fxsz == 1 );
|
||||
const auto memsize = sizeof( VarArray<CallstackFrameId> ) + sz * sizeof( CallstackFrameId );
|
||||
auto mem = (char*)m_slab.AllocRaw( memsize );
|
||||
@ -7411,30 +7413,70 @@ void Worker::UpdateSampleStatisticsImpl( const CallstackFrameData** frames, uint
|
||||
auto arr = (VarArray<CallstackFrameId>*)( mem + sz * sizeof( CallstackFrameId ) );
|
||||
new(arr) VarArray<CallstackFrameId>( sz, data );
|
||||
|
||||
uint32_t idx;
|
||||
auto it = m_data.parentCallstackMap.find( arr );
|
||||
if( it == m_data.parentCallstackMap.end() )
|
||||
{
|
||||
idx = m_data.parentCallstackPayload.size();
|
||||
m_data.parentCallstackMap.emplace( arr, idx );
|
||||
parentIdx = m_data.parentCallstackPayload.size();
|
||||
m_data.parentCallstackMap.emplace( arr, parentIdx );
|
||||
m_data.parentCallstackPayload.push_back( arr );
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = it->second;
|
||||
parentIdx = it->second;
|
||||
m_slab.Unalloc( memsize );
|
||||
}
|
||||
}
|
||||
|
||||
sym0 = m_data.symbolStats.find( frame0.symAddr );
|
||||
auto sit = sym0->second.parents.find( idx );
|
||||
auto sit = sym0->second.parents.find( parentIdx );
|
||||
if( sit == sym0->second.parents.end() )
|
||||
{
|
||||
sym0->second.parents.emplace( idx, count );
|
||||
sym0->second.parents.emplace( parentIdx, count );
|
||||
}
|
||||
else
|
||||
{
|
||||
sit->second += count;
|
||||
}
|
||||
|
||||
uint32_t baseParentIdx;
|
||||
{
|
||||
const auto sz = framesCount - 1;
|
||||
const auto memsize = sizeof( VarArray<CallstackFrameId> ) + sz * sizeof( CallstackFrameId );
|
||||
auto mem = (char*)m_slab.AllocRaw( memsize );
|
||||
|
||||
auto data = (CallstackFrameId*)mem;
|
||||
auto dst = data;
|
||||
for( int i=0; i<sz; i++ )
|
||||
{
|
||||
*dst++ = cs[i+1];
|
||||
}
|
||||
|
||||
auto arr = (VarArray<CallstackFrameId>*)( mem + sz * sizeof( CallstackFrameId ) );
|
||||
new(arr) VarArray<CallstackFrameId>( sz, data );
|
||||
|
||||
auto it = m_data.parentCallstackMap.find( arr );
|
||||
if( it == m_data.parentCallstackMap.end() )
|
||||
{
|
||||
baseParentIdx = m_data.parentCallstackPayload.size();
|
||||
m_data.parentCallstackMap.emplace( arr, baseParentIdx );
|
||||
m_data.parentCallstackPayload.push_back( arr );
|
||||
}
|
||||
else
|
||||
{
|
||||
baseParentIdx = it->second;
|
||||
m_slab.Unalloc( memsize );
|
||||
}
|
||||
}
|
||||
|
||||
auto bit = sym0->second.baseParents.find( baseParentIdx );
|
||||
if( bit == sym0->second.baseParents.end() )
|
||||
{
|
||||
sym0->second.baseParents.emplace( baseParentIdx, count );
|
||||
}
|
||||
else
|
||||
{
|
||||
bit->second += count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user