mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 05:33:53 +00:00
Display message when there's no data for flame graph.
This commit is contained in:
parent
dfcc5ae37e
commit
52e0cf38b7
@ -445,24 +445,36 @@ void View::DrawFlameGraph()
|
|||||||
for( auto& v : data ) zsz += v.time;
|
for( auto& v : data ) zsz += v.time;
|
||||||
|
|
||||||
ImGui::BeginChild( "##flameGraph" );
|
ImGui::BeginChild( "##flameGraph" );
|
||||||
DrawFlameGraphHeader( m_flameMode == 0 ? zsz : zsz * m_worker.GetSamplingPeriod() );
|
|
||||||
|
|
||||||
const auto region = ImGui::GetContentRegionAvail();
|
const auto region = ImGui::GetContentRegionAvail();
|
||||||
FlameGraphContext ctx;
|
|
||||||
ctx.draw = ImGui::GetWindowDrawList();
|
|
||||||
ctx.wpos = ImGui::GetCursorScreenPos();
|
|
||||||
ctx.dpos = ctx.wpos + ImVec2( 0.5f, 0.5f );
|
|
||||||
ctx.ty = ImGui::GetTextLineHeight();
|
|
||||||
ctx.ostep = ctx.ty + 1;
|
|
||||||
ctx.pxns = region.x / zsz;
|
|
||||||
ctx.nxps = 1.0 / ctx.pxns;
|
|
||||||
|
|
||||||
ImGui::ItemSize( region );
|
if( data.empty() )
|
||||||
uint64_t ts = 0;
|
|
||||||
for( auto& v : data )
|
|
||||||
{
|
{
|
||||||
DrawFlameGraphItem( v, ctx, ts, 0, m_flameMode == 1 );
|
ImGui::PushFont( m_bigFont );
|
||||||
ts += v.time;
|
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() );
|
||||||
|
|
||||||
|
FlameGraphContext ctx;
|
||||||
|
ctx.draw = ImGui::GetWindowDrawList();
|
||||||
|
ctx.wpos = ImGui::GetCursorScreenPos();
|
||||||
|
ctx.dpos = ctx.wpos + ImVec2( 0.5f, 0.5f );
|
||||||
|
ctx.ty = ImGui::GetTextLineHeight();
|
||||||
|
ctx.ostep = ctx.ty + 1;
|
||||||
|
ctx.pxns = region.x / zsz;
|
||||||
|
ctx.nxps = 1.0 / ctx.pxns;
|
||||||
|
|
||||||
|
ImGui::ItemSize( region );
|
||||||
|
uint64_t ts = 0;
|
||||||
|
for( auto& v : data )
|
||||||
|
{
|
||||||
|
DrawFlameGraphItem( v, ctx, ts, 0, m_flameMode == 1 );
|
||||||
|
ts += v.time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user