Remember if there is branch retirement data.

This commit is contained in:
Bartosz Taudul 2022-04-01 18:46:46 +02:00
parent 4a8c4bde34
commit 381f706796
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 5 additions and 2 deletions

View File

@ -238,7 +238,7 @@ static tracy_force_inline void UpdateLockRange( LockMap& lockmap, const LockEven
} }
template<size_t U> template<size_t U>
static void ReadHwSampleVec( FileRead& f, SortedVector<Int48, Int48Sort>& vec, Slab<U>& slab ) static uint64_t ReadHwSampleVec( FileRead& f, SortedVector<Int48, Int48Sort>& vec, Slab<U>& slab )
{ {
uint64_t sz; uint64_t sz;
f.Read( sz ); f.Read( sz );
@ -251,6 +251,7 @@ static void ReadHwSampleVec( FileRead& f, SortedVector<Int48, Int48Sort>& vec, S
vec[i] = ReadTimeOffset( f, refTime ); vec[i] = ReadTimeOffset( f, refTime );
} }
} }
return sz;
} }
// Should be just a simple comparison. Do this when protocol version changes. // Should be just a simple comparison. Do this when protocol version changes.
@ -1915,7 +1916,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
ReadHwSampleVec( f, data.retired, m_slab ); ReadHwSampleVec( f, data.retired, m_slab );
ReadHwSampleVec( f, data.cacheRef, m_slab ); ReadHwSampleVec( f, data.cacheRef, m_slab );
ReadHwSampleVec( f, data.cacheMiss, m_slab ); ReadHwSampleVec( f, data.cacheMiss, m_slab );
ReadHwSampleVec( f, data.branchRetired, m_slab ); if( ReadHwSampleVec( f, data.branchRetired, m_slab ) != 0 ) m_data.hasBranchRetirement = true;
ReadHwSampleVec( f, data.branchMiss, m_slab ); ReadHwSampleVec( f, data.branchMiss, m_slab );
} }
} }
@ -7129,6 +7130,7 @@ void Worker::ProcessHwSampleBranchRetired( const QueueHwSample& ev )
auto it = m_data.hwSamples.find( ev.ip ); auto it = m_data.hwSamples.find( ev.ip );
if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first; if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first;
it->second.branchRetired.push_back( time ); it->second.branchRetired.push_back( time );
m_data.hasBranchRetirement = true;
} }
void Worker::ProcessHwSampleBranchMiss( const QueueHwSample& ev ) void Worker::ProcessHwSampleBranchMiss( const QueueHwSample& ev )

View File

@ -391,6 +391,7 @@ private:
unordered_flat_map<const char*, MemoryBlock, charutil::Hasher, charutil::Comparator> sourceFileCache; unordered_flat_map<const char*, MemoryBlock, charutil::Hasher, charutil::Comparator> sourceFileCache;
unordered_flat_map<uint64_t, HwSampleData> hwSamples; unordered_flat_map<uint64_t, HwSampleData> hwSamples;
bool hasBranchRetirement = false;
unordered_flat_map<uint64_t, uint64_t> fiberToThreadMap; unordered_flat_map<uint64_t, uint64_t> fiberToThreadMap;
}; };