VTK: Rendering/OpenGL2/vtkOpenGLRenderTimer.h Source File

| VTK 9.3.1

vtkOpenGLRenderTimer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3
19 #ifndef vtkOpenGLRenderTimer_h
20 #define vtkOpenGLRenderTimer_h
21
22 #include "vtkRenderingOpenGL2Module.h" // For export macro
23 #include "vtkType.h" // For vtkTypeUint64, etc
24
25 VTK_ABI_NAMESPACE_BEGIN
26 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimer
27 {
28 public:
29 vtkOpenGLRenderTimer();
30 ~vtkOpenGLRenderTimer();
31
36 static bool IsSupported();
37
41 void Reset();
42
46 void Start();
47
51 void Stop();
52
56 bool Started();
57
61 bool Stopped();
62
66 bool Ready();
67
69
72 float GetElapsedSeconds();
73 float GetElapsedMilliseconds();
74 vtkTypeUInt64 GetElapsedNanoseconds();
76
78
103 void ReusableStart();
104 void ReusableStop();
105 float GetReusableElapsedSeconds();
107
112 vtkTypeUInt64 GetStartTime();
113 vtkTypeUInt64 GetStopTime();
120 void ReleaseGraphicsResources();
121
122 protected:
123 bool StartReady;
124 bool EndReady;
125
126 vtkTypeUInt32 StartQuery;
127 vtkTypeUInt32 EndQuery;
128
129 vtkTypeUInt64 StartTime;
130 vtkTypeUInt64 EndTime;
131
132 bool ReusableStarted;
133 bool ReusableEnded;
134
135 private:
136 vtkOpenGLRenderTimer(const vtkOpenGLRenderTimer&) = delete;
137 void operator=(const vtkOpenGLRenderTimer&) = delete;
138 };
139
140 VTK_ABI_NAMESPACE_END
141 #endif // vtkOpenGLRenderTimer_h
142
143 // VTK-HeaderTest-Exclude: vtkOpenGLRenderTimer.h
vtkOpenGLRenderTimer
Asynchronously measures GPU execution time for a single event.
Definition: vtkOpenGLRenderTimer.h:27
vtkOpenGLRenderTimer::StartReady
bool StartReady
Definition: vtkOpenGLRenderTimer.h:123
vtkOpenGLRenderTimer::ReusableStarted
bool ReusableStarted
Definition: vtkOpenGLRenderTimer.h:132
vtkOpenGLRenderTimer::ReusableStart
void ReusableStart()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
vtkOpenGLRenderTimer::Reset
void Reset()
Clear out any previous results and prepare for a new query.
vtkOpenGLRenderTimer::Stopped
bool Stopped()
Returns true if the timer has been stopped.
vtkOpenGLRenderTimer::Started
bool Started()
Returns true if the timer has been started.
vtkOpenGLRenderTimer::GetElapsedNanoseconds
vtkTypeUInt64 GetElapsedNanoseconds()
If Ready() returns true, get the elapsed time in the requested units.
vtkOpenGLRenderTimer::GetReusableElapsedSeconds
float GetReusableElapsedSeconds()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
vtkOpenGLRenderTimer::StartTime
vtkTypeUInt64 StartTime
Definition: vtkOpenGLRenderTimer.h:129
vtkOpenGLRenderTimer::Start
void Start()
Mark the start of a timed event.
vtkOpenGLRenderTimer::GetElapsedMilliseconds
float GetElapsedMilliseconds()
If Ready() returns true, get the elapsed time in the requested units.
vtkOpenGLRenderTimer::ReusableStop
void ReusableStop()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
vtkOpenGLRenderTimer::~vtkOpenGLRenderTimer
~vtkOpenGLRenderTimer()
vtkOpenGLRenderTimer::EndReady
bool EndReady
Definition: vtkOpenGLRenderTimer.h:124
vtkOpenGLRenderTimer::GetStopTime
vtkTypeUInt64 GetStopTime()
If Ready() returns true, return the start or stop time in nanoseconds.
vtkOpenGLRenderTimer::EndTime
vtkTypeUInt64 EndTime
Definition: vtkOpenGLRenderTimer.h:130
vtkOpenGLRenderTimer::StartQuery
vtkTypeUInt32 StartQuery
Definition: vtkOpenGLRenderTimer.h:126
vtkOpenGLRenderTimer::GetStartTime
vtkTypeUInt64 GetStartTime()
If Ready() returns true, return the start or stop time in nanoseconds.
vtkOpenGLRenderTimer::vtkOpenGLRenderTimer
vtkOpenGLRenderTimer()
vtkOpenGLRenderTimer::Stop
void Stop()
Mark the end of a timed event.
vtkOpenGLRenderTimer::GetElapsedSeconds
float GetElapsedSeconds()
If Ready() returns true, get the elapsed time in the requested units.
vtkOpenGLRenderTimer::ReusableEnded
bool ReusableEnded
Definition: vtkOpenGLRenderTimer.h:133
vtkOpenGLRenderTimer::EndQuery
vtkTypeUInt32 EndQuery
Definition: vtkOpenGLRenderTimer.h:127
vtkOpenGLRenderTimer::ReleaseGraphicsResources
void ReleaseGraphicsResources()
Simply calls Reset() to ensure that query ids are freed.
vtkOpenGLRenderTimer::IsSupported
static bool IsSupported()
Returns true if timer events are supported by the current OpenGL implementation.
vtkOpenGLRenderTimer::Ready
bool Ready()
Returns true when the timing results are available.
vtkType.h