Nameless Engine
Loading...
Searching...
No Matches
RenderStatistics.h
1#pragma once
2
3// Standard.
4#include <chrono>
5#include <optional>
6#include <atomic>
7#include <mutex>
8
9namespace ne {
12 // Renderer will update statistics.
13 friend class Renderer;
14
15 public:
16 RenderStatistics() = default;
17
18 RenderStatistics(const RenderStatistics&) = delete;
19 RenderStatistics& operator=(const RenderStatistics&) = delete;
20
26 size_t getFramesPerSecond() const;
27
33 size_t getLastFrameDrawCallCount() const;
34
41 size_t getLastFrameCulledMeshCount() const;
42
49 size_t getLastFrameCulledLightCount() const;
50
60
67
74
75 private:
82 std::chrono::steady_clock::time_point timeAtLastFpsUpdate;
83
89
91 size_t iFramesPerSecond = 0;
92 };
93
95 struct FpsLimitInfo {
97 std::chrono::steady_clock::time_point frameStartTime;
98
101 };
102
113
120
127 };
128
130 struct Counters {
137
144
147 };
148
156
162 std::pair<std::mutex, float> mtxFrustumCullingMeshesTimeInMs;
163
169 std::pair<std::mutex, float> mtxFrustumCullingLightsTimeInMs;
170
172 std::atomic<size_t> iCulledMeshCount{0};
173
175 std::atomic<size_t> iCulledLightCount{0};
176
178 std::atomic<size_t> iDrawCallCount{0};
179 };
180
186
189
192
195
198
201 };
202}
Definition: RenderStatistics.h:11
FrameTemporaryStatistics frameTemporaryStatistics
Definition: RenderStatistics.h:200
float getTimeSpentLastFrameOnFrustumCullingLights() const
Definition: RenderStatistics.cpp:30
size_t getFramesPerSecond() const
Definition: RenderStatistics.cpp:10
FpsLimitInfo fpsLimitInfo
Definition: RenderStatistics.h:191
Counters counters
Definition: RenderStatistics.h:197
size_t getLastFrameCulledMeshCount() const
Definition: RenderStatistics.cpp:14
size_t getLastFrameDrawCallCount() const
Definition: RenderStatistics.cpp:12
float getTimeSpentLastFrameOnFrustumCullingMeshes() const
Definition: RenderStatistics.cpp:26
float getTimeSpentLastFrameWaitingForGpu() const
Definition: RenderStatistics.cpp:22
TaskTimeInfo taskTimeInfo
Definition: RenderStatistics.h:194
FramesPerSecondInfo fpsInfo
Definition: RenderStatistics.h:188
size_t getLastFrameCulledLightCount() const
Definition: RenderStatistics.cpp:18
void saveAndResetTemporaryFrameStatistics()
Definition: RenderStatistics.cpp:34
Definition: Renderer.h:43
Definition: RenderStatistics.h:130
size_t iLastFrameCulledLightsCount
Definition: RenderStatistics.h:143
size_t iLastFrameDrawCallCount
Definition: RenderStatistics.h:146
size_t iLastFrameCulledMeshesCount
Definition: RenderStatistics.h:136
Definition: RenderStatistics.h:95
std::chrono::steady_clock::time_point frameStartTime
Definition: RenderStatistics.h:97
std::optional< double > optionalTargetTimeToRenderFrameInNs
Definition: RenderStatistics.h:100
Definition: RenderStatistics.h:154
std::atomic< size_t > iCulledMeshCount
Definition: RenderStatistics.h:172
std::pair< std::mutex, float > mtxFrustumCullingLightsTimeInMs
Definition: RenderStatistics.h:169
std::pair< std::mutex, float > mtxFrustumCullingMeshesTimeInMs
Definition: RenderStatistics.h:162
std::atomic< size_t > iDrawCallCount
Definition: RenderStatistics.h:178
std::atomic< size_t > iCulledLightCount
Definition: RenderStatistics.h:175
Definition: RenderStatistics.h:77
size_t iFramesPerSecond
Definition: RenderStatistics.h:91
size_t iPresentCountSinceFpsUpdate
Definition: RenderStatistics.h:88
std::chrono::steady_clock::time_point timeAtLastFpsUpdate
Definition: RenderStatistics.h:82
Definition: RenderStatistics.h:104
float timeSpentLastFrameOnFrustumCullingMeshesInMs
Definition: RenderStatistics.h:119
float timeSpentLastFrameWaitingForGpuInMs
Definition: RenderStatistics.h:112
float timeSpentLastFrameOnFrustumCullingLightsInMs
Definition: RenderStatistics.h:126