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

Support logarithmic scaling of values on search histogram.

This commit is contained in:
Bartosz Taudul 2018-02-16 13:28:40 +01:00
parent 508b699252
commit 9678cc8afc
2 changed files with 22 additions and 5 deletions

View File

@ -4190,6 +4190,8 @@ void View::DrawFindZone()
}
}
ImGui::Checkbox( "Log values", &m_findZone.logVal );
ImGui::Text( "tMin: %s", TimeToString( tmin ) );
ImGui::Text( "tMax: %s", TimeToString( tmax ) );
@ -4231,13 +4233,27 @@ void View::DrawFindZone()
maxVal = std::max( maxVal, bins[i] );
}
const auto hAdj = double( Height - 4 ) / maxVal;
for( int i=0; i<numBins; i++ )
if( m_findZone.logVal )
{
if( bins[i] > 0 )
const auto hAdj = double( Height - 4 ) / log10( maxVal + 1 );
for( int i=0; i<numBins; i++ )
{
draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - bins[i] * hAdj ), 0xFF22DDDD );
if( bins[i] > 0 )
{
draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - log10( bins[i] + 1 ) * hAdj ), 0xFF22DDDD );
}
}
}
else
{
const auto hAdj = double( Height - 4 ) / maxVal;
for( int i=0; i<numBins; i++ )
{
if( bins[i] > 0 )
{
draw->AddLine( wpos + ImVec2( 2+i, Height-3 ), wpos + ImVec2( 2+i, Height-3 - bins[i] * hAdj ), 0xFF22DDDD );
}
}
}
}

View File

@ -288,6 +288,7 @@ private:
char pattern[1024] = { "" };
int maxZonesPerThread = 1000;
int maxDepth = 10;
bool logVal = false;
} m_findZone;
bool m_terminate;