Show branch impact if no retirement data available.

Some CPUs are only able to report branch miss data, but not branch retirement
data.
This commit is contained in:
Bartosz Taudul 2022-04-01 19:06:15 +02:00
parent d8ec98042a
commit 88a153504d
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -4416,6 +4416,7 @@ void SourceView::GatherIpHwStats( AddrStatData& as, Worker& worker, const View&
void SourceView::CountHwStats( AddrStatData& as, Worker& worker, const View& view )
{
const auto hasBranchRetirement = worker.HasHwBranchRetirement();
auto filename = m_source.filename();
for( auto& v : m_asm )
{
@ -4425,13 +4426,27 @@ void SourceView::CountHwStats( AddrStatData& as, Worker& worker, const View& vie
if( !hw ) continue;
uint64_t branch, cache;
if( view.m_statRange.active )
{
if( hasBranchRetirement )
{
branch = sqrt( CountHwSamples( hw->branchMiss, view.m_statRange ) * CountHwSamples( hw->branchRetired, view.m_statRange ) );
}
else
{
branch = CountHwSamples( hw->branchMiss, view.m_statRange );
}
cache = sqrt( CountHwSamples( hw->cacheMiss, view.m_statRange ) * CountHwSamples( hw->cacheRef, view.m_statRange ) );
}
else
{
if( hasBranchRetirement )
{
branch = sqrt( hw->branchMiss.size() * hw->branchRetired.size() );
}
else
{
branch = hw->branchMiss.size();
}
cache = sqrt( hw->cacheMiss.size() * hw->cacheRef.size() );
}
assert( as.hwCountAsm.find( addr ) == as.hwCountAsm.end() );