1 #include "stdafx.h"
2 #include "DebuggerTypes.h"
3 
4 struct PerfTrackerData
5 {
6 	int updateTimer = 0;
7 	int frameCount = 0;
8 	int prevFrameCount = 0;
9 	bool frameProcessed = false;
10 	int fps = 60;
11 	int totalFrame = 1;
12 	int gameFrame = 1;
13 
14 	int isLagFramePos = 0;
15 	bool isLagFrame[60] = {};
16 
17 	int fpsChartPos = 0;
18 	int fpsChartDataPoints[256] = {};
19 	int totalCpu = 50;
20 	int cpuEntry = 1;
21 	int partialCpu = 0;
22 	int updateCpu = 50;
23 	int cpuChartPos = 0;
24 	int cpuChartDataPoints[256] = {};
25 };
26 
27 enum PerfTrackerSpeed
28 {
29 	Normal = 0,
30 	Fast = 1
31 };
32 
33 class PerformanceTracker
34 {
35 private:
36 	shared_ptr<Console> _console;
37 	PerfTrackerData _data;
38 
39 	int32_t _address = -1;
40 	AddressType _type = AddressType::InternalRam;
41 	PerfTrackerMode _mode = PerfTrackerMode::Disabled;
42 	PerfTrackerSpeed _updateSpeed = PerfTrackerSpeed::Normal;
43 	bool _needReset = false;
44 	bool _leftButtonPressed = false;
45 	bool _rightButtonPressed = false;
46 
47 	void ProcessMouseInput();
48 	void DrawChart(int *dataPoints, int startPos, int color, int scale, int maxValue);
49 
50 public:
51 	PerformanceTracker(shared_ptr<Console> console);
52 	void Initialize(int32_t address, AddressType type, PerfTrackerMode mode);
53 	PerfTrackerMode GetMode();
54 	void ProcessEndOfFrame();
55 	void ProcessCpuExec(AddressTypeInfo &addressInfo);
56 };
57