diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 84cf73f5..8c3edc84 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2739,6 +2739,16 @@ void View::DrawFindZone() ImGui::Checkbox( "Log values", &m_findZone.logVal ); ImGui::SameLine(); ImGui::Checkbox( "Log time", &m_findZone.logTime ); + ImGui::SameLine(); + ImGui::Checkbox( "Cumulate time", &m_findZone.cumulateTime ); + ImGui::SameLine(); + ImGui::TextDisabled( "(?)" ); + if( ImGui::IsItemHovered() ) + { + ImGui::BeginTooltip(); + ImGui::Text( "Show total time taken by calls in each bin instead of call counts." ); + ImGui::EndTooltip(); + } ImGui::Text( "Time range: %s - %s (%s)", TimeToString( tmin ), TimeToString( tmax ), TimeToString( tmax - tmin ) ); @@ -2770,8 +2780,8 @@ void View::DrawFindZone() const auto numBins = int64_t( w - 4 ); if( numBins > 1 ) { - auto bins = std::make_unique( numBins ); - memset( bins.get(), 0, sizeof( uint64_t ) * numBins ); + auto bins = std::make_unique( numBins ); + memset( bins.get(), 0, sizeof( int64_t ) * numBins ); auto binTime = std::make_unique( numBins ); memset( binTime.get(), 0, sizeof( int64_t ) * numBins ); @@ -2807,11 +2817,24 @@ void View::DrawFindZone() } int64_t timeTotal = binTime[0]; - auto maxVal = bins[0]; - for( int i=1; i 0 ) + const auto val = m_findZone.cumulateTime ? binTime[i] : bins[i]; + if( val > 0 ) { - draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - log10( bins[i] + 1 ) * hAdj ), 0xFF22DDDD ); + draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - log10( val + 1 ) * hAdj ), 0xFF22DDDD ); } } } @@ -2846,9 +2870,10 @@ void View::DrawFindZone() const auto hAdj = double( Height - 4 ) / maxVal; for( int i=0; i 0 ) + const auto val = m_findZone.cumulateTime ? binTime[i] : bins[i]; + if( val > 0 ) { - draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - bins[i] * hAdj ), 0xFF22DDDD ); + draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - val * hAdj ), 0xFF22DDDD ); } } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index c62dc5b7..e9ab56b7 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -176,6 +176,7 @@ private: int maxDepth = -1; bool logVal = false; bool logTime = false; + bool cumulateTime = false; Region highlight; void Reset()