diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-07-24 13:10:46 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-07-24 13:10:46 +0300 |
commit | 3393471dcc405b65f6fcfcb00f6575c76c0e1366 (patch) | |
tree | b97f9d0276611792be8a12ffa1ab59dc859e5ed5 /server/TracyView_Plots.cpp | |
parent | a3b6a9c95cd6617a1b3cc4f6e6ae2021d65ecaee (diff) |
Draw memory plot ranges on top of plot.
Diffstat (limited to 'server/TracyView_Plots.cpp')
-rw-r--r-- | server/TracyView_Plots.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/server/TracyView_Plots.cpp b/server/TracyView_Plots.cpp index 5c9f4730..363d0436 100644 --- a/server/TracyView_Plots.cpp +++ b/server/TracyView_Plots.cpp @@ -179,45 +179,6 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl draw->AddRectFilled( ImVec2( 0, yPos ), ImVec2( w, yPos + PlotHeight ), bg ); - if( v->type == PlotType::Memory ) - { - auto& mem = m_worker.GetMemoryNamed( v->name ); - - if( m_memoryAllocInfoPool == v->name && m_memoryAllocInfoWindow >= 0 ) - { - const auto& ev = mem.data[m_memoryAllocInfoWindow]; - - const auto tStart = ev.TimeAlloc(); - const auto tEnd = ev.TimeFree() < 0 ? m_worker.GetLastTime() : ev.TimeFree(); - - const auto px0 = ( tStart - m_vd.zvStart ) * pxns; - const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( tEnd - m_vd.zvStart ) * pxns ); - draw->AddRectFilled( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x2288DD88 ); - draw->AddRect( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x4488DD88 ); - } - if( m_memoryAllocHover >= 0 && m_memoryAllocHoverPool == v->name && ( m_memoryAllocInfoPool != v->name || m_memoryAllocHover != m_memoryAllocInfoWindow ) ) - { - const auto& ev = mem.data[m_memoryAllocHover]; - - const auto tStart = ev.TimeAlloc(); - const auto tEnd = ev.TimeFree() < 0 ? m_worker.GetLastTime() : ev.TimeFree(); - - const auto px0 = ( tStart - m_vd.zvStart ) * pxns; - const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( tEnd - m_vd.zvStart ) * pxns ); - draw->AddRectFilled( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x228888DD ); - draw->AddRect( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x448888DD ); - - if( m_memoryAllocHoverWait > 0 ) - { - m_memoryAllocHoverWait--; - } - else - { - m_memoryAllocHover = -1; - } - } - } - auto it = std::lower_bound( vec.begin(), vec.end(), m_vd.zvStart - m_worker.GetDelay(), [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } ); auto end = std::lower_bound( it, vec.end(), m_vd.zvEnd + m_worker.GetResolution(), [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } ); @@ -371,6 +332,45 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl } } + if( v->type == PlotType::Memory ) + { + auto& mem = m_worker.GetMemoryNamed( v->name ); + + if( m_memoryAllocInfoPool == v->name && m_memoryAllocInfoWindow >= 0 ) + { + const auto& ev = mem.data[m_memoryAllocInfoWindow]; + + const auto tStart = ev.TimeAlloc(); + const auto tEnd = ev.TimeFree() < 0 ? m_worker.GetLastTime() : ev.TimeFree(); + + const auto px0 = ( tStart - m_vd.zvStart ) * pxns; + const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( tEnd - m_vd.zvStart ) * pxns ); + draw->AddRectFilled( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x2288DD88 ); + draw->AddRect( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x4488DD88 ); + } + if( m_memoryAllocHover >= 0 && m_memoryAllocHoverPool == v->name && ( m_memoryAllocInfoPool != v->name || m_memoryAllocHover != m_memoryAllocInfoWindow ) ) + { + const auto& ev = mem.data[m_memoryAllocHover]; + + const auto tStart = ev.TimeAlloc(); + const auto tEnd = ev.TimeFree() < 0 ? m_worker.GetLastTime() : ev.TimeFree(); + + const auto px0 = ( tStart - m_vd.zvStart ) * pxns; + const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( tEnd - m_vd.zvStart ) * pxns ); + draw->AddRectFilled( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x228888DD ); + draw->AddRect( ImVec2( wpos.x + px0, yPos ), ImVec2( wpos.x + px1, yPos + PlotHeight ), 0x448888DD ); + + if( m_memoryAllocHoverWait > 0 ) + { + m_memoryAllocHoverWait--; + } + else + { + m_memoryAllocHover = -1; + } + } + } + if( yPos + ty >= yMin && yPos <= yMax ) { char tmp[64]; |