2016-08-23 00:54:10 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
#include <map>
|
|
|
|
#include "Types.h"
|
|
|
|
#include "Singleton.h"
|
|
|
|
#include "Profiler.h"
|
2019-07-24 19:33:42 -04:00
|
|
|
#include "../PS2VM.h"
|
2016-08-23 00:54:10 +01:00
|
|
|
|
|
|
|
class CStatsManager : public CSingleton<CStatsManager>
|
|
|
|
{
|
|
|
|
public:
|
2024-01-12 13:50:34 -05:00
|
|
|
void OnNewFrame(CPS2VM*);
|
|
|
|
void OnGsNewFrame(uint32);
|
2022-01-10 15:57:45 -05:00
|
|
|
|
|
|
|
static float ComputeCpuUsageRatio(int32 idleTicks, int32 totalTicks);
|
2018-04-30 21:01:23 +01:00
|
|
|
|
|
|
|
uint32 GetFrames();
|
|
|
|
uint32 GetDrawCalls();
|
2022-01-10 15:57:45 -05:00
|
|
|
CPS2VM::CPU_UTILISATION_INFO GetCpuUtilisationInfo();
|
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
|
|
|
private:
|
2018-04-30 21:01:23 +01:00
|
|
|
std::mutex m_statsMutex;
|
|
|
|
|
|
|
|
uint32 m_frames = 0;
|
|
|
|
uint32 m_drawCalls = 0;
|
|
|
|
|
2022-01-10 15:57:45 -05:00
|
|
|
CPS2VM::CPU_UTILISATION_INFO m_cpuUtilisation;
|
|
|
|
|
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;
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
std::mutex m_profilerZonesMutex;
|
|
|
|
ZoneMap m_profilerZones;
|
2016-08-23 00:54:10 +01:00
|
|
|
#endif
|
|
|
|
};
|