Display FPS counts next to frame times.

This commit is contained in:
Bartosz Taudul 2019-08-03 15:20:31 +02:00
parent 51bdbdb71f
commit da88e32887

View File

@ -974,6 +974,8 @@ void View::DrawFrames()
ImGui::Text( "%s - %s (%s)", RealToString( sel, true ), RealToString( sel + g - 1, true ), RealToString( g, true ) ); ImGui::Text( "%s - %s (%s)", RealToString( sel, true ), RealToString( sel + g - 1, true ), RealToString( g, true ) );
ImGui::Separator(); ImGui::Separator();
TextFocused( "Max frame time:", TimeToString( f ) ); TextFocused( "Max frame time:", TimeToString( f ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%.1f FPS)", 1000000000.0 / f );
} }
else else
{ {
@ -993,7 +995,10 @@ void View::DrawFrames()
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( RealToString( sel, true ) ); ImGui::TextUnformatted( RealToString( sel, true ) );
ImGui::Separator(); ImGui::Separator();
TextFocused( "Frame time:", TimeToString( m_worker.GetFrameTime( *m_frames, sel ) ) ); const auto frameTime = m_worker.GetFrameTime( *m_frames, sel );
TextFocused( "Frame time:", TimeToString( frameTime ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%.1f FPS)", 1000000000.0 / frameTime );
} }
else if( sel == 1 ) else if( sel == 1 )
{ {
@ -1007,7 +1012,10 @@ void View::DrawFrames()
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( RealToString( sel + offset - 1, true ) ); ImGui::TextUnformatted( RealToString( sel + offset - 1, true ) );
ImGui::Separator(); ImGui::Separator();
TextFocused( "Frame time:", TimeToString( m_worker.GetFrameTime( *m_frames, sel ) ) ); const auto frameTime = m_worker.GetFrameTime( *m_frames, sel );
TextFocused( "Frame time:", TimeToString( frameTime ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%.1f FPS)", 1000000000.0 / frameTime );
} }
} }
else else
@ -1016,7 +1024,10 @@ void View::DrawFrames()
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( RealToString( sel + 1, true ) ); ImGui::TextUnformatted( RealToString( sel + 1, true ) );
ImGui::Separator(); ImGui::Separator();
TextFocused( "Frame time:", TimeToString( m_worker.GetFrameTime( *m_frames, sel ) ) ); const auto frameTime = m_worker.GetFrameTime( *m_frames, sel );
TextFocused( "Frame time:", TimeToString( frameTime ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%.1f FPS)", 1000000000.0 / frameTime );
} }
} }
TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( *m_frames, sel ) - m_worker.GetTimeBegin() ) ); TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( *m_frames, sel ) - m_worker.GetTimeBegin() ) );
@ -1431,6 +1442,8 @@ bool View::DrawZoneFrames( const FrameData& frames )
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::TextUnformatted( GetFrameText( frames, i, ftime, m_worker.GetFrameOffset() ) ); ImGui::TextUnformatted( GetFrameText( frames, i, ftime, m_worker.GetFrameOffset() ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%.1f FPS)", 1000000000.0 / ftime );
TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( frames, i ) - m_worker.GetTimeBegin() ) ); TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( frames, i ) - m_worker.GetTimeBegin() ) );
auto fi = m_worker.GetFrameImage( frames, i ); auto fi = m_worker.GetFrameImage( frames, i );
if( fi ) if( fi )