mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 21:53:52 +00:00
Store instruction pointer stats as AddrStat.
This commit is contained in:
parent
3845c392fa
commit
0d8ee47231
@ -1093,8 +1093,8 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
|
|||||||
TextFocused( ICON_FA_WEIGHT_HANGING " Code size:", MemSizeToString( m_codeLen ) );
|
TextFocused( ICON_FA_WEIGHT_HANGING " Code size:", MemSizeToString( m_codeLen ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t iptotalSrc = 0, iptotalAsm = 0;
|
AddrStat iptotalSrc = {}, iptotalAsm = {};
|
||||||
uint32_t ipmaxSrc = 0, ipmaxAsm = 0;
|
AddrStat ipmaxSrc = {}, ipmaxAsm = {};
|
||||||
unordered_flat_map<uint64_t, AddrStat> ipcountSrc, ipcountAsm;
|
unordered_flat_map<uint64_t, AddrStat> ipcountSrc, ipcountAsm;
|
||||||
if( m_calcInlineStats )
|
if( m_calcInlineStats )
|
||||||
{
|
{
|
||||||
@ -1115,7 +1115,7 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
|
|||||||
}
|
}
|
||||||
iptotalSrc = iptotalAsm;
|
iptotalSrc = iptotalAsm;
|
||||||
}
|
}
|
||||||
if( iptotalAsm > 0 || ( view.m_statRange.active && worker.GetSamplesForSymbol( m_baseAddr ) ) )
|
if( iptotalAsm.local > 0 || ( view.m_statRange.active && worker.GetSamplesForSymbol( m_baseAddr ) ) )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@ -1124,11 +1124,11 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextFocused( ICON_FA_STOPWATCH " Time:", TimeToString( iptotalAsm * worker.GetSamplingPeriod() ) );
|
TextFocused( ICON_FA_STOPWATCH " Time:", TimeToString( iptotalAsm.local * worker.GetSamplingPeriod() ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextFocused( ICON_FA_EYE_DROPPER " Samples:", RealToString( iptotalAsm ) );
|
TextFocused( ICON_FA_EYE_DROPPER " Samples:", RealToString( iptotalAsm.local ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -1176,16 +1176,16 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
|
|||||||
switch( m_displayMode )
|
switch( m_displayMode )
|
||||||
{
|
{
|
||||||
case DisplaySource:
|
case DisplaySource:
|
||||||
RenderSymbolSourceView( iptotalSrc, ipcountSrc, ipcountAsm, ipmaxSrc, worker, view );
|
RenderSymbolSourceView( iptotalSrc.local, ipcountSrc, ipcountAsm, ipmaxSrc.local, worker, view );
|
||||||
break;
|
break;
|
||||||
case DisplayAsm:
|
case DisplayAsm:
|
||||||
jumpOut = RenderSymbolAsmView( iptotalAsm, ipcountAsm, ipmaxAsm, worker, view );
|
jumpOut = RenderSymbolAsmView( iptotalAsm.local, ipcountAsm, ipmaxAsm.local, worker, view );
|
||||||
break;
|
break;
|
||||||
case DisplayMixed:
|
case DisplayMixed:
|
||||||
ImGui::Columns( 2 );
|
ImGui::Columns( 2 );
|
||||||
RenderSymbolSourceView( iptotalSrc, ipcountSrc, ipcountAsm, ipmaxSrc, worker, view );
|
RenderSymbolSourceView( iptotalSrc.local, ipcountSrc, ipcountAsm, ipmaxSrc.local, worker, view );
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
jumpOut = RenderSymbolAsmView( iptotalAsm, ipcountAsm, ipmaxAsm, worker, view );
|
jumpOut = RenderSymbolAsmView( iptotalAsm.local, ipcountAsm, ipmaxAsm.local, worker, view );
|
||||||
ImGui::EndColumns();
|
ImGui::EndColumns();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -3149,7 +3149,7 @@ void SourceView::SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, uint32_t& ipmaxSrc, uint32_t& ipmaxAsm, const Worker& worker, bool limitView, const View& view )
|
void SourceView::GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, AddrStat& ipmaxSrc, AddrStat& ipmaxAsm, const Worker& worker, bool limitView, const View& view )
|
||||||
{
|
{
|
||||||
auto filename = m_source.filename();
|
auto filename = m_source.filename();
|
||||||
if( limitView )
|
if( limitView )
|
||||||
@ -3159,7 +3159,7 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
|
|||||||
auto it = std::lower_bound( vec->begin(), vec->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
auto it = std::lower_bound( vec->begin(), vec->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
if( it == vec->end() ) return;
|
if( it == vec->end() ) return;
|
||||||
auto end = std::lower_bound( it, vec->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
auto end = std::lower_bound( it, vec->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
iptotalAsm += end - it;
|
iptotalAsm.local += end - it;
|
||||||
while( it != end )
|
while( it != end )
|
||||||
{
|
{
|
||||||
if( filename )
|
if( filename )
|
||||||
@ -3177,15 +3177,15 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
|
|||||||
if( sit == ipcountSrc.end() )
|
if( sit == ipcountSrc.end() )
|
||||||
{
|
{
|
||||||
ipcountSrc.emplace( line, AddrStat { 1, 0 } );
|
ipcountSrc.emplace( line, AddrStat { 1, 0 } );
|
||||||
if( ipmaxSrc < 1 ) ipmaxSrc = 1;
|
if( ipmaxSrc.local < 1 ) ipmaxSrc.local = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto sum = sit->second.local + 1;
|
const auto sum = sit->second.local + 1;
|
||||||
sit->second.local = sum;
|
sit->second.local = sum;
|
||||||
if( ipmaxSrc < sum ) ipmaxSrc = sum;
|
if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum;
|
||||||
}
|
}
|
||||||
iptotalSrc++;
|
iptotalSrc.local++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3196,13 +3196,13 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
|
|||||||
if( sit == ipcountAsm.end() )
|
if( sit == ipcountAsm.end() )
|
||||||
{
|
{
|
||||||
ipcountAsm.emplace( addr, AddrStat{ 1, 0 } );
|
ipcountAsm.emplace( addr, AddrStat{ 1, 0 } );
|
||||||
if( ipmaxAsm < 1 ) ipmaxAsm = 1;
|
if( ipmaxAsm.local < 1 ) ipmaxAsm.local = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto sum = sit->second.local + 1;
|
const auto sum = sit->second.local + 1;
|
||||||
sit->second.local = sum;
|
sit->second.local = sum;
|
||||||
if( ipmaxAsm < sum ) ipmaxAsm = sum;
|
if( ipmaxAsm.local < sum ) ipmaxAsm.local = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
@ -3229,15 +3229,15 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
|
|||||||
if( it == ipcountSrc.end() )
|
if( it == ipcountSrc.end() )
|
||||||
{
|
{
|
||||||
ipcountSrc.emplace( line, AddrStat{ ip.second, 0 } );
|
ipcountSrc.emplace( line, AddrStat{ ip.second, 0 } );
|
||||||
if( ipmaxSrc < ip.second ) ipmaxSrc = ip.second;
|
if( ipmaxSrc.local < ip.second ) ipmaxSrc.local = ip.second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto sum = it->second.local + ip.second;
|
const auto sum = it->second.local + ip.second;
|
||||||
it->second.local = sum;
|
it->second.local = sum;
|
||||||
if( ipmaxSrc < sum ) ipmaxSrc = sum;
|
if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum;
|
||||||
}
|
}
|
||||||
iptotalSrc += ip.second;
|
iptotalSrc.local += ip.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3246,8 +3246,8 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
|
|||||||
auto addr = worker.GetCanonicalPointer( ip.first );
|
auto addr = worker.GetCanonicalPointer( ip.first );
|
||||||
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );
|
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );
|
||||||
ipcountAsm.emplace( addr, AddrStat { ip.second, 0 } );
|
ipcountAsm.emplace( addr, AddrStat { ip.second, 0 } );
|
||||||
iptotalAsm += ip.second;
|
iptotalAsm.local += ip.second;
|
||||||
if( ipmaxAsm < ip.second ) ipmaxAsm = ip.second;
|
if( ipmaxAsm.local < ip.second ) ipmaxAsm.local = ip.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ private:
|
|||||||
void SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool changeAsmLine = true, uint64_t targetAddr = 0 );
|
void SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool changeAsmLine = true, uint64_t targetAddr = 0 );
|
||||||
void SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker );
|
void SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker );
|
||||||
|
|
||||||
void GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, uint32_t& ipmaxSrc, uint32_t& ipmaxAsm, const Worker& worker, bool limitView, const View& view );
|
void GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, AddrStat& ipmaxSrc, AddrStat& ipmaxAsm, const Worker& worker, bool limitView, const View& view );
|
||||||
uint32_t CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view );
|
uint32_t CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view );
|
||||||
|
|
||||||
void SelectMicroArchitecture( const char* moniker );
|
void SelectMicroArchitecture( const char* moniker );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user