mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Restrict sample statistics percentages to time range limit.
This commit is contained in:
parent
b9a810827d
commit
34fa99c7ee
@ -12274,6 +12274,18 @@ void View::DrawStatistics()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
double revSampleCount100;
|
||||||
|
if( m_statRange.active )
|
||||||
|
{
|
||||||
|
const auto st = m_statRange.max - m_statRange.min;
|
||||||
|
const auto cnt = st / m_worker.GetSamplingPeriod();
|
||||||
|
revSampleCount100 = 100. / cnt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
revSampleCount100 = 100. / m_worker.GetCallstackSampleCount();
|
||||||
|
}
|
||||||
|
|
||||||
const bool showAll = m_showAllSymbols;
|
const bool showAll = m_showAllSymbols;
|
||||||
const auto period = m_worker.GetSamplingPeriod();
|
const auto period = m_worker.GetSamplingPeriod();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@ -12449,16 +12461,18 @@ void View::DrawStatistics()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
if( cnt > 0 )
|
if( cnt > 0 )
|
||||||
{
|
{
|
||||||
|
char buf[64];
|
||||||
if( m_statSampleTime )
|
if( m_statSampleTime )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( TimeToString( cnt * period ) );
|
const auto t = cnt * period;
|
||||||
|
ImGui::TextUnformatted( TimeToString( t ) );
|
||||||
|
PrintStringPercent( buf, 100. * t / timeRange );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( RealToString( cnt ) );
|
ImGui::TextUnformatted( RealToString( cnt ) );
|
||||||
|
PrintStringPercent( buf, cnt * revSampleCount100 );
|
||||||
}
|
}
|
||||||
char buf[64];
|
|
||||||
PrintStringPercent( buf, 100. * cnt / m_worker.GetCallstackSampleCount() );
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextDisabledUnformatted( buf );
|
TextDisabledUnformatted( buf );
|
||||||
}
|
}
|
||||||
@ -12613,16 +12627,18 @@ void View::DrawStatistics()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
if( cnt > 0 )
|
if( cnt > 0 )
|
||||||
{
|
{
|
||||||
|
char buf[64];
|
||||||
if( m_statSampleTime )
|
if( m_statSampleTime )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( TimeToString( cnt * period ) );
|
const auto t = cnt * period;
|
||||||
|
ImGui::TextUnformatted( TimeToString( t ) );
|
||||||
|
PrintStringPercent( buf, 100. * t / timeRange );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( RealToString( cnt ) );
|
ImGui::TextUnformatted( RealToString( cnt ) );
|
||||||
|
PrintStringPercent( buf, cnt * revSampleCount100 );
|
||||||
}
|
}
|
||||||
char buf[64];
|
|
||||||
PrintStringPercent( buf, 100. * cnt / m_worker.GetCallstackSampleCount() );
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextDisabledUnformatted( buf );
|
TextDisabledUnformatted( buf );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user