Basic flame graph window layout.

This commit is contained in:
Bartosz Taudul 2024-09-07 19:52:44 +02:00
parent 5b75954c5b
commit e4ec798762
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 26 additions and 0 deletions

View File

@ -494,6 +494,7 @@ private:
AccumulationMode m_statAccumulationMode = AccumulationMode::SelfOnly;
bool m_statSampleTime = true;
int m_statMode = 0;
int m_flameMode = 0;
int m_statSampleLocation = 2;
bool m_statHideUnknown = true;
bool m_showAllSymbols = false;

View File

@ -92,6 +92,31 @@ void View::DrawFlameGraph()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Flame graph", &m_showFlameGraph, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 2, 2 ) );
ImGui::RadioButton( ICON_FA_SYRINGE " Instrumentation", &m_flameMode, 0 );
if( m_worker.AreCallstackSamplesReady() && m_worker.GetCallstackSampleCount() > 0 )
{
ImGui::SameLine();
ImGui::RadioButton( ICON_FA_EYE_DROPPER " Sampling", &m_flameMode, 1 );
}
ImGui::Separator();
ImGui::PopStyleVar();
Vector<FlameGraphItem> data;
for( auto& thread : m_worker.GetThreadData() ) BuildFlameGraph( m_worker, data, thread->timeline );
SortFlameGraph( data );
int64_t zsz = 0;
for( auto& v : data ) zsz += v.time;
ImGui::BeginChild( "##flameGraph" );
ImGui::EndChild();
ImGui::End();
}