From c90c0d6140ecb5fba8c6e4e40d4dad7e7548405d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 6 Oct 2017 14:42:51 +0200 Subject: [PATCH] Profiler display one line/level --- profiling.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/profiling.cc b/profiling.cc index 64103c4..5089041 100644 --- a/profiling.cc +++ b/profiling.cc @@ -176,15 +176,25 @@ void T_Profiler::makeUI( ) // Plot static constexpr float plHeight = 5; - float lh( 0 ); + uint32_t dLine[ n ]; + uint32_t cLine = 0; angle = 0; for ( auto i = 0u ; i < n ; i ++ ) { angle = fmod( angle + 137 , 360 ); + if ( i != 0 ) { + if ( chain_[ i ] == Invalid ) { + cLine ++; + } else { + cLine = dLine[ chain_[ i ] ]; + } + } + dLine[ i ] = cLine; if ( !displayed_[ i ] ) { continue; } const float lx0 = msWidth * secStarts_[ i ]; const float lx1 = msWidth * ( secStarts_[ i ] + secDurations_[ i ] ); + const float lh = cLine * ( plHeight + 1 ); const float ly1 = lh + plHeight; ImVec4 color( 0 , 0 , 0 , 1 ); ImGui::ColorConvertHSVtoRGB( angle / 360. , .5 , 1 , @@ -192,7 +202,6 @@ void T_Profiler::makeUI( ) dl->AddRectFilled( ImVec2( start.x + lx0 , start.y + lh ) , ImVec2( start.x + lx1 , start.y + ly1 ) , ImGui::GetColorU32( color ) ); - lh = ly1 + 1; } ImGui::End( );