Add indirect hw statistics.

This commit is contained in:
Bartosz Taudul 2021-06-20 00:01:37 +02:00
parent ad2b6e932b
commit 326a2a70d8
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -1230,7 +1230,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
ImGui::SameLine();
ImGui::TextUnformatted( ICON_FA_HIGHLIGHTER " Cost" );
ImGui::SameLine();
const char* items[] = { "Sample count", "Cycles", "Retirements", "Branches taken", "Branch miss", "Cache access", "Cache miss" };
const char* items[] = { "Sample count", "Cycles", "Retirements", "Branches taken", "Branch miss", "Slow branches", "Cache access", "Cache miss", "Slow cache" };
float mw = 0;
for( auto& v : items )
{
@ -3965,7 +3965,7 @@ void SourceView::SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker
void SourceView::GatherIpHwStats( AddrStat& iptotalSrc, AddrStat& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, AddrStat& ipmaxSrc, AddrStat& ipmaxAsm, Worker& worker, bool limitView, const View& view )
{
assert( m_cost >= 1 && m_cost <= 6 );
assert( m_cost >= 1 && m_cost <= 8 );
auto filename = m_source.filename();
for( auto& v : m_asm )
{
@ -3982,8 +3982,10 @@ void SourceView::GatherIpHwStats( AddrStat& iptotalSrc, AddrStat& iptotalAsm, un
case 2: stat = CountHwSamples( hw->retired, view.m_statRange ); break;
case 3: stat = CountHwSamples( hw->branchRetired, view.m_statRange ); break;
case 4: stat = CountHwSamples( hw->branchMiss, view.m_statRange ); break;
case 5: stat = CountHwSamples( hw->cacheRef, view.m_statRange ); break;
case 6: stat = CountHwSamples( hw->cacheMiss, view.m_statRange ); break;
case 5: stat = CountHwSamples( hw->branchMiss, view.m_statRange ) * CountHwSamples( hw->branchRetired, view.m_statRange ); break;
case 6: stat = CountHwSamples( hw->cacheRef, view.m_statRange ); break;
case 7: stat = CountHwSamples( hw->cacheMiss, view.m_statRange ); break;
case 8: stat = CountHwSamples( hw->cacheMiss, view.m_statRange ) * CountHwSamples( hw->cacheRef, view.m_statRange ); break;
}
}
else
@ -3994,8 +3996,10 @@ void SourceView::GatherIpHwStats( AddrStat& iptotalSrc, AddrStat& iptotalAsm, un
case 2: stat = hw->retired.size(); break;
case 3: stat = hw->branchRetired.size(); break;
case 4: stat = hw->branchMiss.size(); break;
case 5: stat = hw->cacheRef.size(); break;
case 6: stat = hw->cacheMiss.size(); break;
case 5: stat = hw->branchMiss.size() * hw->branchRetired.size(); break;
case 6: stat = hw->cacheRef.size(); break;
case 7: stat = hw->cacheMiss.size(); break;
case 8: stat = hw->cacheMiss.size() * hw->cacheRef.size(); break;
}
}
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );