SpiecsEngine
 
Loading...
Searching...
No Matches
NsightPerfGPUProfilerContinuous.h
Go to the documentation of this file.
1/**
2* @file NsightPerfGPUProfilerContinuous.h
3* @brief The NsightPerfGPUProfilerContinuous Class Definitions.
4* @author Spices
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include "Render/Vulkan/VulkanUtils.h"
10
11#include "NvPerfPeriodicSamplerGpu.h"
12#include "NvPerfCounterData.h"
13#include "NvPerfMetricsEvaluator.h"
14
15namespace Spices {
16
17 /**
18 * @brief Wrapper of Nvidia Nsight Performance Metrics.
19 */
21 {
22 public:
23
24 /**
25 * @brief Constructor Function.
26 * @param[in] state VulkanState.
27 */
29
30 /**
31 * @brief Destructor Function.
32 */
33 virtual ~NsightPerfGPUProfilerContinuous() = default;
34
35 /**
36 * @brief Create this Single Instance.
37 * @param[in] state VulkanState.
38 */
39 static void CreateInstance(VulkanState& state);
40
41 /**
42 * @brief Begin this Session.
43 */
44 void Create(VulkanState& state);
45
46 /**
47 * @brief Get this Single Instance.
48 * @return Returns this Single Instance.
49 */
51
52 /**
53 * @brief Begin a frame.
54 * @param[in] state VulkanState.
55 */
56 void BeginFrame(VulkanState& state);
57
58 /**
59 * @brief ConsumeSample each frame.
60 */
61 void EndFrame();
62
63 /**
64 * @brief Capture this frame.
65 */
66 void CaptureFrame();
67
68 /**
69 * @brief Reset on quit application.
70 */
71 void Reset();
72
73 private:
74
75 /**
76 * @brief VulkanState.
77 */
79
80 /**
81 * @brief This Single Instance.
82 */
84
85 /**
86 * @brief the periodic sampler.
87 */
89
90 /**
91 * @brief This is used to store the counter values collected during profiling.
92 */
94
95 /**
96 * @brief Metrics requests.
97 */
99
100 /**
101 * @brief MetricsEvaluator.
102 */
104
105 /**
106 * @brief True if in session.
107 */
109
110 /**
111 * @brief True if want capture next frame.
112 */
114 };
115
116#ifdef SPICES_DEBUG
117
118#define NSIGHTPERF_GPUPROFILERCONTINUOUS_CREATEINSTANCE(...) { ::Spices::NsightPerfGPUProfilerContinuous::CreateInstance(__VA_ARGS__); }
119#define NSIGHTPERF_GPUPROFILERCONTINUOUS_BEGINFRAME(...) { ::Spices::NsightPerfGPUProfilerContinuous::Get().BeginFrame(__VA_ARGS__); }
120#define NSIGHTPERF_GPUPROFILERCONTINUOUS_ENDFRAME { ::Spices::NsightPerfGPUProfilerContinuous::Get().EndFrame(); }
121#define NSIGHTPERF_GPUPROFILERCONTINUOUS_CAPTUREFRAME //{ ::Spices::NsightPerfGPUProfilerContinuous::Get().CaptureFrame(); }
122#define NSIGHTPERF_GPUPROFILERCONTINUOUS_RESET { ::Spices::NsightPerfGPUProfilerContinuous::Get().Reset(); }
123
124#endif
125
126#ifdef SPICES_RELEASE
127
128#define NSIGHTPERF_GPUPROFILERCONTINUOUS_CREATEINSTANCE(...)
129#define NSIGHTPERF_GPUPROFILERCONTINUOUS_BEGINFRAME(...)
130#define NSIGHTPERF_GPUPROFILERCONTINUOUS_ENDFRAME
131#define NSIGHTPERF_GPUPROFILERCONTINUOUS_CAPTUREFRAME
132#define NSIGHTPERF_GPUPROFILERCONTINUOUS_RESET
133
134#endif
135
136}
#define NSPERF_CHECK(val)
#define SPICES_PROFILE_ZONE
std::vector< NVPW_MetricEvalRequest > metricEvalRequests
Metrics requests.
static NsightPerfGPUProfilerContinuous & Get()
Get this Single Instance.
static void CreateInstance(VulkanState &state)
Create this Single Instance.
NsightPerfGPUProfilerContinuous(VulkanState &state)
Constructor Function.
virtual ~NsightPerfGPUProfilerContinuous()=default
Destructor Function.
void Create(VulkanState &state)
Begin this Session.
nv::perf::MetricsEvaluator metricsEvaluator
MetricsEvaluator.
bool m_EnableCaptureNextFrame
True if want capture next frame.
nv::perf::sampler::RingBufferCounterData counterData
This is used to store the counter values collected during profiling.
nv::perf::sampler::GpuPeriodicSampler sampler
the periodic sampler.
static std::shared_ptr< NsightPerfGPUProfilerContinuous > m_NsightPerfGPUProfilerContinuous
This Single Instance.
void BeginFrame(VulkanState &state)
Begin a frame.
Wrapper of Nvidia Nsight Performance Metrics.
const char * Metrics[]
The following metrics are for demonstration purposes only. For a more comprehensive set of single-pas...
This struct contains all Vulkan object in used global.
Definition VulkanUtils.h:74