Include hw stats in AddrStatData.

This commit is contained in:
Bartosz Taudul 2021-07-18 14:57:26 +02:00
parent e30608afbf
commit fbf2c87a20
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 15 additions and 12 deletions

View File

@ -4106,7 +4106,7 @@ void SourceView::GatherIpHwStats( AddrStatData& as, Worker& worker, const View&
}
}
void SourceView::CountHwStats( unordered_flat_map<uint64_t, AddrStat>& hwCountSrc, unordered_flat_map<uint64_t, AddrStat>& hwCountAsm, AddrStat& hwMaxSrc, AddrStat& hwMaxAsm, Worker& worker, const View& view )
void SourceView::CountHwStats( AddrStatData& as, Worker& worker, const View& view )
{
auto filename = m_source.filename();
for( auto& v : m_asm )
@ -4127,9 +4127,9 @@ void SourceView::CountHwStats( unordered_flat_map<uint64_t, AddrStat>& hwCountSr
cache = sqrt( hw->cacheMiss.size() * hw->cacheRef.size() );
}
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );
hwCountAsm.emplace( addr, AddrStat { branch, cache } );
if( hwMaxAsm.local < branch ) hwMaxAsm.local = branch;
if( hwMaxAsm.ext < cache ) hwMaxAsm.ext = cache;
as.hwCountAsm.emplace( addr, AddrStat { branch, cache } );
if( as.hwMaxAsm.local < branch ) as.hwMaxAsm.local = branch;
if( as.hwMaxAsm.ext < cache ) as.hwMaxAsm.ext = cache;
if( filename )
{
@ -4140,12 +4140,12 @@ void SourceView::CountHwStats( unordered_flat_map<uint64_t, AddrStat>& hwCountSr
auto ffn = worker.GetString( fref );
if( strcmp( ffn, filename ) == 0 )
{
auto it = hwCountSrc.find( line );
if( it == hwCountSrc.end() )
auto it = as.hwCountSrc.find( line );
if( it == as.hwCountSrc.end() )
{
hwCountSrc.emplace( line, AddrStat{ branch, cache } );
if( hwMaxSrc.local < branch ) hwMaxSrc.local = branch;
if( hwMaxSrc.ext < cache ) hwMaxSrc.ext = cache;
as.hwCountSrc.emplace( line, AddrStat{ branch, cache } );
if( as.hwMaxSrc.local < branch ) as.hwMaxSrc.local = branch;
if( as.hwMaxSrc.ext < cache ) as.hwMaxSrc.ext = cache;
}
else
{
@ -4153,8 +4153,8 @@ void SourceView::CountHwStats( unordered_flat_map<uint64_t, AddrStat>& hwCountSr
const auto cacheSum = it->second.ext + cache;
it->second.local = branchSum;
it->second.ext = cacheSum;
if( hwMaxSrc.local < branchSum ) hwMaxSrc.local = branchSum;
if( hwMaxSrc.ext < cacheSum ) hwMaxSrc.ext = cacheSum;
if( as.hwMaxSrc.local < branchSum ) as.hwMaxSrc.local = branchSum;
if( as.hwMaxSrc.ext < cacheSum ) as.hwMaxSrc.ext = cacheSum;
}
}
}

View File

@ -132,7 +132,10 @@ private:
AddrStat ipTotalAsm = {};
AddrStat ipMaxSrc = {};
AddrStat ipMaxAsm = {};
AddrStat hwMaxSrc = {};
AddrStat hwMaxAsm = {};
unordered_flat_map<uint64_t, AddrStat> ipCountSrc, ipCountAsm;
unordered_flat_map<uint64_t, AddrStat> hwCountSrc, hwCountAsm;
};
public:
@ -173,7 +176,7 @@ private:
void GatherIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
void GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
uint32_t CountAsmIpStats( uint64_t baseAddr, const Worker& worker, bool limitView, const View& view );
void CountHwStats( unordered_flat_map<uint64_t, AddrStat>& hwCountSrc, unordered_flat_map<uint64_t, AddrStat>& hwCountAsm, AddrStat& hwMaxSrc, AddrStat& hwMaxAsm, Worker& worker, const View& view );
void CountHwStats( AddrStatData& as, Worker& worker, const View& view );
void SelectMicroArchitecture( const char* moniker );