Play-/Source/ui_shared/StatsManager.h

49 lines
805 B
C
Raw Normal View History

2016-08-23 00:54:10 +01:00
#pragma once
#include <mutex>
#include <map>
#include "Types.h"
#include "Singleton.h"
#include "Profiler.h"
#include "../PS2VM.h"
2016-08-23 00:54:10 +01:00
class CStatsManager : public CSingleton<CStatsManager>
{
public:
2018-04-30 21:01:23 +01:00
void OnNewFrame(uint32);
uint32 GetFrames();
uint32 GetDrawCalls();
2016-08-23 00:54:10 +01:00
#ifdef PROFILE
2018-04-30 21:01:23 +01:00
std::string GetProfilingInfo();
2016-08-23 00:54:10 +01:00
#endif
2018-04-30 21:01:23 +01:00
void ClearStats();
2016-08-23 00:54:10 +01:00
#ifdef PROFILE
void OnProfileFrameDone(CPS2VM*, const CProfiler::ZoneArray&);
2016-08-23 00:54:10 +01:00
#endif
2018-04-30 21:01:23 +01:00
2016-08-23 00:54:10 +01:00
private:
2018-04-30 21:01:23 +01:00
std::mutex m_statsMutex;
uint32 m_frames = 0;
uint32 m_drawCalls = 0;
2016-08-23 00:54:10 +01:00
#ifdef PROFILE
struct ZONEINFO
{
uint64 currentValue = 0;
uint64 minValue = ~0ULL;
uint64 maxValue = 0;
};
typedef std::map<std::string, ZONEINFO> ZoneMap;
CPS2VM::CPU_UTILISATION_INFO m_cpuUtilisation;
2018-04-30 21:01:23 +01:00
std::mutex m_profilerZonesMutex;
ZoneMap m_profilerZones;
2016-08-23 00:54:10 +01:00
#endif
};