Implement listing all symbols.

This commit is contained in:
Bartosz Taudul 2020-03-26 22:38:24 +01:00
parent e58b9e870e
commit c098a03d8f

View File

@ -11700,30 +11700,68 @@ void View::DrawStatistics()
}; };
Vector<SymList> data; Vector<SymList> data;
data.reserve( symStat.size() ); if( m_showAllSymbols )
auto statit = symStat.begin();
if( m_statisticsFilter.IsActive() )
{ {
while( statit != symStat.end() ) data.reserve( symMap.size() );
if( m_statisticsFilter.IsActive() )
{ {
auto sit = symMap.find( statit->first ); for( auto& v : symMap )
if( sit != symMap.end() )
{ {
auto name = m_worker.GetString( sit->second.name ); auto name = m_worker.GetString( v.second.name );
if( m_statisticsFilter.PassFilter( name ) ) if( m_statisticsFilter.PassFilter( name ) )
{ {
data.push_back_no_space_check( SymList { statit->first, statit->second.incl, statit->second.excl } ); auto it = symStat.find( v.first );
if( it == symStat.end() )
{
data.push_back_no_space_check( SymList { v.first, 0, 0 } );
}
else
{
data.push_back_no_space_check( SymList { v.first, it->second.incl, it->second.excl } );
}
}
}
}
else
{
for( auto& v : symMap )
{
auto it = symStat.find( v.first );
if( it == symStat.end() )
{
data.push_back_no_space_check( SymList { v.first, 0, 0 } );
}
else
{
data.push_back_no_space_check( SymList { v.first, it->second.incl, it->second.excl } );
} }
} }
++statit;
} }
} }
else else
{ {
while( statit != symStat.end() ) data.reserve( symStat.size() );
if( m_statisticsFilter.IsActive() )
{ {
data.push_back_no_space_check( SymList { statit->first, statit->second.incl, statit->second.excl } ); for( auto& v : symStat )
++statit; {
auto sit = symMap.find( v.first );
if( sit != symMap.end() )
{
auto name = m_worker.GetString( sit->second.name );
if( m_statisticsFilter.PassFilter( name ) )
{
data.push_back_no_space_check( SymList { v.first, v.second.incl, v.second.excl } );
}
}
}
}
else
{
for( auto& v : symStat )
{
data.push_back_no_space_check( SymList { v.first, v.second.incl, v.second.excl } );
}
} }
} }
@ -11767,12 +11805,13 @@ void View::DrawStatistics()
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator(); ImGui::Separator();
const bool showAll = m_showAllSymbols;
const auto period = m_worker.GetSamplingPeriod(); const auto period = m_worker.GetSamplingPeriod();
int idx = 0; int idx = 0;
for( auto& v : data ) for( auto& v : data )
{ {
const auto cnt = m_statSelf ? v.excl : v.incl; const auto cnt = m_statSelf ? v.excl : v.incl;
if( cnt > 0 ) if( cnt > 0 || showAll )
{ {
const char* name = "[unknown]"; const char* name = "[unknown]";
const char* file = "[unknown]"; const char* file = "[unknown]";
@ -11862,18 +11901,21 @@ void View::DrawStatistics()
ImGui::NextColumn(); ImGui::NextColumn();
TextDisabledUnformatted( imageName ); TextDisabledUnformatted( imageName );
ImGui::NextColumn(); ImGui::NextColumn();
if( m_statSampleTime ) if( cnt > 0 )
{ {
ImGui::TextUnformatted( TimeToString( cnt * period ) ); if( m_statSampleTime )
{
ImGui::TextUnformatted( TimeToString( cnt * period ) );
}
else
{
ImGui::TextUnformatted( RealToString( cnt ) );
}
char buf[64];
PrintStringPercent( buf, 100. * cnt / m_worker.GetCallstackSampleCount() );
ImGui::SameLine();
TextDisabledUnformatted( buf );
} }
else
{
ImGui::TextUnformatted( RealToString( cnt ) );
}
char buf[64];
PrintStringPercent( buf, 100. * cnt / m_worker.GetCallstackSampleCount() );
ImGui::SameLine();
TextDisabledUnformatted( buf );
ImGui::NextColumn(); ImGui::NextColumn();
if( symlen != 0 ) TextDisabledUnformatted( MemSizeToString( symlen ) ); if( symlen != 0 ) TextDisabledUnformatted( MemSizeToString( symlen ) );
ImGui::NextColumn(); ImGui::NextColumn();