Hymn to Beauty
C++ 3D Engine
ProfilingManager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <list>
5#include <map>
6
9
10namespace Video {
11class LowLevelRenderer;
12}
13
16 friend class Hub;
17
18 public:
20 void BeginFrame();
21
23 void EndFrame();
24
26
29 bool Active() const;
30
32
35 void SetActive(bool active);
36
38
41 unsigned int GetFrameCount() const;
42
44
47 const float* GetCPUFrameTimes() const;
48
50 void FetchGPUTimeline();
51
53
56 const Profiling::Timeline& GetTimeline() const;
57
58 private:
61 ProfilingManager(ProfilingManager const&) = delete;
62 void operator=(ProfilingManager const&) = delete;
63
64 bool active;
65
66 Profiling::Timeline timeline;
67 Profiling::Thread* mainThread;
68 Profiling::Event* currentFrameEvent;
69
70 Video::LowLevelRenderer* lowLevelRenderer;
71 Profiling::Thread* gpuThread;
72
73 unsigned int currentFrame = 0;
74
75 double frameStart;
76 static const unsigned int frames = 100;
77 unsigned int frame = 0;
78 float frameTimes[2][frames];
79};
Singleton class that holds all subsystems.
Definition: Managers.hpp:16
A profiling event on the timeline.
Definition: Event.hpp:10
A thread containing events.
Definition: Thread.hpp:12
A timeline.
Definition: Timeline.hpp:12
Handles profiling.
Definition: ProfilingManager.hpp:15
unsigned int GetFrameCount() const
Get number of frames being monitored.
Definition: ProfilingManager.cpp:89
bool Active() const
Check whether ProfilingManager is active.
Definition: ProfilingManager.cpp:51
void SetActive(bool active)
Set whether ProfilingManager is active.
Definition: ProfilingManager.cpp:55
void EndFrame()
End profiling a frame and collect the results.
Definition: ProfilingManager.cpp:36
const Profiling::Timeline & GetTimeline() const
Get the timeline.
Definition: ProfilingManager.cpp:105
const float * GetCPUFrameTimes() const
Get the measured CPU frame times.
Definition: ProfilingManager.cpp:93
void FetchGPUTimeline()
Get GPU timeline from the render manager.
Definition: ProfilingManager.cpp:97
void BeginFrame()
Begin profiling a frame.
Definition: ProfilingManager.cpp:24
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan).
Definition: LowLevelRenderer.hpp:27
Definition: Editor.hpp:18