Display program run time percentage in lines selection summary.

This commit is contained in:
Bartosz Taudul 2024-03-23 13:54:39 +01:00
parent ef9f2d247d
commit 4c1b06034b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2256,13 +2256,21 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker,
ImGui::SameLine();
if( m_cost == CostType::SampleCount )
{
int64_t time;
if( m_childCalls )
{
TextFocused( "Time:", TimeToString( ( count.local + count.ext ) * worker.GetSamplingPeriod() ) );
time = ( count.local + count.ext ) * worker.GetSamplingPeriod();
}
else
{
TextFocused( "Time:", TimeToString( count.local * worker.GetSamplingPeriod() ) );
time = count.local * worker.GetSamplingPeriod();
}
TextFocused( "Time:", TimeToString( time ) );
const auto timePct = 100.f * time / worker.GetLastTime();
if( timePct >= 0.01f )
{
ImGui::SameLine();
ImGui::TextDisabled( "(%.2f%% run time)", timePct );
}
ImGui::SameLine();
ImGui::Spacing();
@ -3097,13 +3105,21 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
ImGui::SameLine();
if( m_cost == CostType::SampleCount )
{
int64_t time;
if( m_childCalls )
{
TextFocused( "Time:", TimeToString( ( count.local + count.ext ) * worker.GetSamplingPeriod() ) );
time = ( count.local + count.ext ) * worker.GetSamplingPeriod();
}
else
{
TextFocused( "Time:", TimeToString( count.local * worker.GetSamplingPeriod() ) );
time = count.local * worker.GetSamplingPeriod();
}
TextFocused( "Time:", TimeToString( time ) );
const auto timePct = 100.f * time / worker.GetLastTime();
if( timePct >= 0.01f )
{
ImGui::SameLine();
ImGui::TextDisabled( "(%.2f%% run time)", timePct );
}
ImGui::SameLine();
ImGui::Spacing();