Display "no entries" message in statistics menu, if appropriate.

This commit is contained in:
Bartosz Taudul 2020-03-26 22:15:58 +01:00
parent ef96ecd9b8
commit e6b0bfc90d

View File

@ -11523,6 +11523,13 @@ void View::DrawStatistics()
#endif #endif
ImGui::Separator(); ImGui::Separator();
if( srcloc.empty() )
{
ImGui::TextUnformatted( "No entries to be displayed." );
}
else
{
ImGui::BeginChild( "##statistics" ); ImGui::BeginChild( "##statistics" );
const auto w = ImGui::GetWindowWidth(); const auto w = ImGui::GetWindowWidth();
static bool widthSet = false; static bool widthSet = false;
@ -11605,6 +11612,7 @@ void View::DrawStatistics()
ImGui::EndColumns(); ImGui::EndColumns();
ImGui::EndChild(); ImGui::EndChild();
} }
}
else else
{ {
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
@ -11654,7 +11662,6 @@ void View::DrawStatistics()
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton( "Sample", &m_statSampleLocation, 1 ); ImGui::RadioButton( "Sample", &m_statSampleLocation, 1 );
ImGui::Separator(); ImGui::Separator();
ImGui::BeginChild( "##statisticsSampling" );
const auto& symMap = m_worker.GetSymbolMap(); const auto& symMap = m_worker.GetSymbolMap();
const auto& symStat = m_worker.GetSymbolStats(); const auto& symStat = m_worker.GetSymbolStats();
@ -11686,6 +11693,13 @@ void View::DrawStatistics()
++statit; ++statit;
} }
} }
if( data.empty() )
{
ImGui::TextUnformatted( "No entries to be displayed." );
}
else
{
if( m_statSelf ) if( m_statSelf )
{ {
pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l->second.excl > r->second.excl; } ); pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l->second.excl > r->second.excl; } );
@ -11695,6 +11709,7 @@ void View::DrawStatistics()
pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l->second.incl > r->second.incl; } ); pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l->second.incl > r->second.incl; } );
} }
ImGui::BeginChild( "##statisticsSampling" );
const auto w = ImGui::GetWindowWidth(); const auto w = ImGui::GetWindowWidth();
static bool widthSet = false; static bool widthSet = false;
ImGui::Columns( 5 ); ImGui::Columns( 5 );
@ -11834,6 +11849,7 @@ void View::DrawStatistics()
ImGui::EndColumns(); ImGui::EndColumns();
ImGui::EndChild(); ImGui::EndChild();
} }
}
#endif #endif
ImGui::End(); ImGui::End();
} }