-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGAHealth.h
More file actions
61 lines (44 loc) · 1.87 KB
/
GAHealth.h
File metadata and controls
61 lines (44 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include "GACommon.h"
#include "Platform/GAPlatform.h"
namespace gameanalytics
{
class GAHealth
{
public:
GAHealth(GAPlatform* platform);
bool enableMemoryTracking = false;
bool enableFPSTracking = false;
bool enableHardwareTracking = false;
bool enableAppBootTimeTracking = false;
void addHealthAnnotations(json& healthEvent);
void addPerformanceData(json& healthEvent);
void addSDKInitData(json& sdkInitEvent);
void addMemoryTracker();
void addFPSTracker(FPSTracker fpsTracker);
virtual void doFpsReading(float fps);
virtual void doAppMemoryReading(int64_t memory);
virtual void doSysMemoryReading(int64_t memory);
protected:
static constexpr int MAX_FPS_VALUE = 120;
static constexpr size_t MAX_FPS_COUNT = MAX_FPS_VALUE + 1;
static constexpr size_t MAX_MEMORY_COUNT = 100 + 1;
static constexpr std::chrono::milliseconds MEMORY_TRACK_FREQ {5000};
static constexpr std::chrono::milliseconds FPS_TRACK_FREQ {1000};
std::array<uint32_t, MAX_MEMORY_COUNT> _appMemoryUsage;
std::array<uint32_t, MAX_MEMORY_COUNT> _sysMemoryUsage;
std::array<uint32_t, MAX_FPS_COUNT> _fpsReadings;
int64_t _totalMemory = 0;
uint32_t _numCores = 0;
std::string _cpuModel;
std::string _hardware;
std::string _gpuModel;
std::string _screenResolution;
GAPlatform* _platform = nullptr;
bool _isMemoryTracked = false;
bool _isFPSTracked = false;
FPSTracker _fpsTracker;
int getMemoryPercent(int64_t memory);
void queryMemory();
};
}