Allow filtering entries in statistics menu.

This commit is contained in:
Bartosz Taudul 2019-11-01 20:42:00 +01:00
parent 5ff40b05b3
commit 0552d75400
2 changed files with 41 additions and 5 deletions

View File

@ -10073,21 +10073,41 @@ void View::DrawStatistics()
return;
}
m_statisticsFilter.Draw( "Filter zones", 200 );
ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT
ImGui::Checkbox( ICON_FA_CLOCK " Show self times", &m_statSelf );
if( ImGui::Button( ICON_FA_BAN " Clear" ) )
#else
ImGui::Checkbox( "Show self times", &m_statSelf );
if( ImGui::Button( "Clear" ) )
#endif
{
m_statisticsFilter.Clear();
}
const auto filterActive = m_statisticsFilter.IsActive();
auto& slz = m_worker.GetSourceLocationZones();
Vector<decltype(slz.begin())> srcloc;
srcloc.reserve( slz.size() );
uint32_t slzcnt = 0;
for( auto it = slz.begin(); it != slz.end(); ++it )
{
if( it->second.total != 0 )
{
slzcnt++;
if( !filterActive )
{
srcloc.push_back_no_space_check( it );
}
else
{
auto& sl = m_worker.GetSourceLocation( it->first );
auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function );
if( m_statisticsFilter.PassFilter( name ) )
{
srcloc.push_back_no_space_check( it );
}
}
}
}
switch( m_statSort )
@ -10120,10 +10140,25 @@ void View::DrawStatistics()
break;
}
TextFocused( "Recorded source locations:", RealToString( srcloc.size(), true ) );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
TextFocused( "Total zone count:", RealToString( slzcnt, true ) );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
TextFocused( "Visible zones:", RealToString( srcloc.size(), true ) );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT
ImGui::Checkbox( ICON_FA_CLOCK " Show self times", &m_statSelf );
#else
ImGui::Checkbox( "Show self times", &m_statSelf );
#endif
ImGui::Separator();
ImGui::BeginChild( "##messages" );
ImGui::BeginChild( "##statistics" );
const auto w = ImGui::GetWindowWidth();
static bool widthSet = false;
ImGui::Columns( 5 );

View File

@ -287,6 +287,7 @@ private:
int m_frameHover = -1;
bool m_messagesScrollBottom;
ImGuiTextFilter m_messageFilter;
ImGuiTextFilter m_statisticsFilter;
int m_visibleMessages = 0;
bool m_disconnectIssued = false;
DecayValue<uint64_t> m_drawThreadMigrations = 0;