1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 20:53:52 +00:00

Display message when there's no data for flame graph.

This commit is contained in:
Bartosz Taudul 2024-09-28 01:24:59 +02:00
parent dfcc5ae37e
commit 52e0cf38b7
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -445,9 +445,20 @@ void View::DrawFlameGraph()
for( auto& v : data ) zsz += v.time;
ImGui::BeginChild( "##flameGraph" );
const auto region = ImGui::GetContentRegionAvail();
if( data.empty() )
{
ImGui::PushFont( m_bigFont );
ImGui::Dummy( ImVec2( 0, ( region.y - ImGui::GetTextLineHeight() * 2 ) * 0.5f ) );
TextCentered( ICON_FA_CAT );
TextCentered( "No data available to display" );
ImGui::PopFont();
}
else
{
DrawFlameGraphHeader( m_flameMode == 0 ? zsz : zsz * m_worker.GetSamplingPeriod() );
const auto region = ImGui::GetContentRegionAvail();
FlameGraphContext ctx;
ctx.draw = ImGui::GetWindowDrawList();
ctx.wpos = ImGui::GetCursorScreenPos();
@ -464,6 +475,7 @@ void View::DrawFlameGraph()
DrawFlameGraphItem( v, ctx, ts, 0, m_flameMode == 1 );
ts += v.time;
}
}
ImGui::EndChild();