1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Group small zones together.

This commit is contained in:
Bartosz Taudul 2017-09-24 16:25:07 +02:00
parent 7683da5f74
commit 86b1e4fd64

View File

@ -1000,10 +1000,26 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
while( it < zitend )
{
auto& ev = **it;
const auto& srcFile = m_srcFile[ev.srcloc];
const char* func = GetString( srcFile.function );
const auto end = GetZoneEnd( ev );
const auto zsz = ( ev.end - ev.start ) * pxns;
if( zsz < 2. )
{
const auto px0 = ( ev.start - m_zvStart ) * pxns;
auto px1 = ( end - m_zvStart ) * pxns;
for(;;)
{
++it;
if( it == zitend ) break;
const auto pxnext = ( GetZoneEnd( **it ) - m_zvStart ) * pxns;
if( pxnext - px1 >= 4. ) break;
px1 = pxnext;
}
draw->AddRectFilled( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ostep ), 0xDDDD6666, 2.f );
}
else
{
const auto& srcFile = m_srcFile[ev.srcloc];
const char* func = GetString( srcFile.function );
const auto tsz = ImGui::CalcTextSize( func );
const auto px0 = std::max( ( ev.start - m_zvStart ) * pxns, -10.0 );
const auto px1 = std::min( ( end - m_zvStart ) * pxns, double( w + 10 ) );
@ -1035,7 +1051,8 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
if( d > maxdepth ) maxdepth = d;
}
it++;
++it;
}
}
}
return maxdepth;