Make InlineStackData non-static.

This commit is contained in:
Bartosz Taudul 2024-05-04 14:42:40 +02:00
parent 377e41fe61
commit fee5982abd
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 9 additions and 8 deletions

View File

@ -4253,8 +4253,7 @@ void Worker::GetStackWithInlines( Vector<InlineStackData>& ret, const VarArray<C
int Worker::AddGhostZone( const VarArray<CallstackFrameId>& cs, Vector<GhostZone>* vec, uint64_t t )
{
static Vector<InlineStackData> stack;
GetStackWithInlines( stack, cs );
GetStackWithInlines( m_inlineStack, cs );
if( !vec->empty() && vec->back().end.Val() > (int64_t)t )
{
@ -4272,17 +4271,17 @@ int Worker::AddGhostZone( const VarArray<CallstackFrameId>& cs, Vector<GhostZone
const int64_t refBackTime = vec->empty() ? 0 : vec->back().end.Val();
int gcnt = 0;
size_t idx = 0;
while( !vec->empty() && idx < stack.size() )
while( !vec->empty() && idx < m_inlineStack.size() )
{
auto& back = vec->back();
const auto& backKey = m_data.ghostFrames[back.frame.Val()];
const auto backFrame = GetCallstackFrame( backKey.frame );
if( !backFrame ) break;
const auto& inlineFrame = backFrame->data[backKey.inlineFrame];
if( inlineFrame.symAddr != stack[idx].symAddr ) break;
if( inlineFrame.symAddr != m_inlineStack[idx].symAddr ) break;
if( back.end.Val() != refBackTime ) break;
back.end.SetVal( t + m_samplingPeriod );
if( ++idx == stack.size() ) break;
if( ++idx == m_inlineStack.size() ) break;
if( back.child < 0 )
{
back.child = m_data.ghostChildren.size();
@ -4293,11 +4292,11 @@ int Worker::AddGhostZone( const VarArray<CallstackFrameId>& cs, Vector<GhostZone
vec = &m_data.ghostChildren[back.child];
}
}
while( idx < stack.size() )
while( idx < m_inlineStack.size() )
{
gcnt++;
uint32_t fid;
GhostKey key { stack[idx].frame, stack[idx].inlineFrame };
GhostKey key { m_inlineStack[idx].frame, m_inlineStack[idx].inlineFrame };
auto it = m_data.ghostFramesMap.find( key );
if( it == m_data.ghostFramesMap.end() )
{
@ -4313,7 +4312,7 @@ int Worker::AddGhostZone( const VarArray<CallstackFrameId>& cs, Vector<GhostZone
zone.start.SetVal( t );
zone.end.SetVal( t + m_samplingPeriod );
zone.frame.SetVal( fid );
if( ++idx == stack.size() )
if( ++idx == m_inlineStack.size() )
{
zone.child = -1;
}

View File

@ -1092,6 +1092,8 @@ private:
uint32_t m_nextSourceCodeQuery = 0;
unordered_flat_map<uint64_t, PowerData> m_powerData;
Vector<InlineStackData> m_inlineStack;
};
}