From 6c76c8098b7ec2dcf510ba7588068237c2f6b79d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 11 Apr 2020 01:59:15 +0200 Subject: [PATCH] Draw hotness markers next to sample percentage counts. --- server/TracySourceView.cpp | 22 ++++++++++++---------- server/TracySourceView.hpp | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 22771c12..d99b3e6c 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -360,7 +360,7 @@ void SourceView::RenderSimpleSourceView() m_targetLine = 0; ImGui::SetScrollHereY(); } - RenderLine( line, lineNum++, 0, 0, nullptr ); + RenderLine( line, lineNum++, 0, 0, 0, nullptr ); } } else @@ -370,7 +370,7 @@ void SourceView::RenderSimpleSourceView() { for( auto i=clipper.DisplayStart; isecond; - RenderLine( m_lines[i], i+1, ipcnt, iptotal, &worker ); + RenderLine( m_lines[i], i+1, ipcnt, iptotal, ipmax, &worker ); } } } @@ -754,7 +754,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_mapsecond; - RenderAsmLine( line, ipcnt, iptotal, worker, jumpOut, maxAddrLen ); + RenderAsmLine( line, ipcnt, iptotal, ipmax, worker, jumpOut, maxAddrLen ); insList.emplace_back( line.addr ); } } @@ -1015,7 +1015,7 @@ static bool PrintPercentage( float val ) return ImGui::IsWindowHovered() && ImGui::IsMouseHoveringRect( wpos, wpos + ImVec2( stw * 7, ty ) ); } -void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, const Worker* worker ) +void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, uint32_t ipmax, const Worker* worker ) { const auto ty = ImGui::GetFontSize(); auto draw = ImGui::GetWindowDrawList(); @@ -1048,6 +1048,7 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint ImGui::EndTooltip(); if( m_font ) ImGui::PushFont( m_font ); } + draw->AddLine( wpos + ImVec2( 0, 1 ), wpos + ImVec2( 0, ty-2 ), GetHotnessColor( ipcnt, ipmax ) ); } ImGui::SameLine( 0, ty ); } @@ -1113,7 +1114,7 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint draw->AddLine( wpos + ImVec2( 0, ty+2 ), wpos + ImVec2( w, ty+2 ), 0x08FFFFFF ); } -void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ) +void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, uint32_t ipmax, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ) { const auto ty = ImGui::GetFontSize(); auto draw = ImGui::GetWindowDrawList(); @@ -1150,6 +1151,7 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip ImGui::EndTooltip(); if( m_font ) ImGui::PushFont( m_font ); } + draw->AddLine( wpos + ImVec2( 0, 1 ), wpos + ImVec2( 0, ty-2 ), GetHotnessColor( ipcnt, ipmax ) ); } ImGui::SameLine( 0, ty ); diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index c20a126b..9806135d 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -65,8 +65,8 @@ private: void RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map ipcount, uint32_t ipmax, const Worker& worker ); uint64_t RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map ipcount, uint32_t ipmax, const Worker& worker ); - void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, const Worker* worker ); - void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ); + void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, uint32_t ipmax, const Worker* worker ); + void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, uint32_t ipmax, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ); void SelectLine( uint32_t line, const Worker* worker, bool changeAsmLine = true, uint64_t targetAddr = 0 ); void SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool changeAsmLine = true, uint64_t targetAddr = 0 );