1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Don't draw off-screen locks.

This commit is contained in:
Bartosz Taudul 2018-04-20 22:53:15 +02:00
parent 723fad84a7
commit cd7a1cffe8
2 changed files with 403 additions and 390 deletions

View File

@ -1045,7 +1045,7 @@ void View::DrawZones()
if( m_drawLocks )
{
const auto depth = DrawLocks( v->id, hover, pxns, wpos, offset, nextLockHighlight );
const auto depth = DrawLocks( v->id, hover, pxns, wpos, offset, nextLockHighlight, yMin, yMax );
offset += ostep * depth;
}
}
@ -1719,7 +1719,7 @@ static LockState CombineLockState( LockState state, LockState next )
return (LockState)std::max( (int)state, (int)next );
}
int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int _offset, LockHighlight& highlight )
int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int _offset, LockHighlight& highlight, float yMin, float yMax )
{
const auto delay = m_worker.GetDelay();
const auto resolution = m_worker.GetResolution();
@ -1753,8 +1753,6 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
if( vbegin > tl.begin() ) vbegin--;
bool drawn = false;
const auto& srcloc = m_worker.GetSourceLocation( lockmap.srcloc );
const auto offset = _offset + ostep * cnt;
LockState state = LockState::Nothing;
@ -1796,6 +1794,12 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
}
}
const auto yPos = wpos.y + offset;
if( yPos + ostep >= yMin && yPos <= yMax )
{
bool drawn = false;
const auto& srcloc = m_worker.GetSourceLocation( lockmap.srcloc );
double pxend = 0;
for(;;)
{
@ -2188,6 +2192,15 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
cnt++;
}
}
else
{
while( vbegin < vend && ( state == LockState::Nothing || ( m_onlyContendedLocks && state == LockState::HasLock ) ) )
{
vbegin = GetNextLockFunc( vbegin, vend, state, threadBit );
}
if( vbegin < vend ) cnt++;
}
}
return cnt;
}

View File

@ -68,7 +68,7 @@ private:
void DrawZones();
int DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
int DrawGpuZoneLevel( const Vector<GpuEvent*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth, uint64_t thread );
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight );
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight, float yMin, float yMax );
int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover );
void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev, bool merged );
void DrawOptions();