Skip to content

Commit

Permalink
RenderStatistics also calculates frames per second
Browse files Browse the repository at this point in the history
Display calculated FPS after the frame render time in msec.
  • Loading branch information
Matthew Mott committed Sep 2, 2020
1 parent 63e99d8 commit 4e0eadc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion radiant/render/RenderStatistics.h
Expand Up @@ -17,7 +17,9 @@ class RenderStatistics
/// Return the constructed string for display
std::string getStatString()
{
return "msec: " + std::to_string(_timer.Time());
long msec = _timer.Time();
return "msec: " + std::to_string(msec)
+ " | fps: " + (msec > 0 ? std::to_string(1000 / msec) : "-");
}

/// Reset statistics at the beginning of a frame render
Expand Down

0 comments on commit 4e0eadc

Please sign in to comment.