mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Don't do performance counting if it's not enabled
This commit is contained in:
parent
b03e547b8c
commit
793d1c4911
|
@ -1,4 +1,5 @@
|
|||
#include "VI.h"
|
||||
#include "Config.h"
|
||||
#include "Performance.h"
|
||||
|
||||
Performance perf;
|
||||
|
@ -8,12 +9,20 @@ Performance::Performance()
|
|||
, m_frames(0)
|
||||
, m_fps(0)
|
||||
, m_vis(0)
|
||||
, m_startTime(0) {
|
||||
, m_startTime(0)
|
||||
, m_enabled(false) {
|
||||
}
|
||||
|
||||
void Performance::reset()
|
||||
{
|
||||
m_startTime = std::clock();
|
||||
m_vi = 0;
|
||||
m_frames = 0;
|
||||
m_fps = 0;
|
||||
m_vis = 0;
|
||||
m_startTime = 0;
|
||||
m_enabled = (config.onScreenDisplay.fps | config.onScreenDisplay.vis | config.onScreenDisplay.percent) != 0;
|
||||
if (m_enabled)
|
||||
m_startTime = std::clock();
|
||||
}
|
||||
|
||||
f32 Performance::getFps() const
|
||||
|
@ -34,6 +43,8 @@ f32 Performance::getPercent() const
|
|||
|
||||
void Performance::increaseVICount()
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
m_vi++;
|
||||
const clock_t curTime = std::clock();
|
||||
const float elapsed = float( curTime - m_startTime ) / CLOCKS_PER_SEC;
|
||||
|
@ -48,5 +59,7 @@ void Performance::increaseVICount()
|
|||
|
||||
void Performance::increaseFramesCount()
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
m_frames++;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ private:
|
|||
f32 m_fps;
|
||||
f32 m_vis;
|
||||
clock_t m_startTime;
|
||||
bool m_enabled;
|
||||
};
|
||||
|
||||
extern Performance perf;
|
||||
|
|
Loading…
Reference in New Issue
Block a user