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

View File

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