VTK  9.3.20240423
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
25VTK_ABI_NAMESPACE_BEGIN
26class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimer
27{
28public:
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
74 vtkTypeUInt64 GetElapsedNanoseconds();
76
78
107
112 vtkTypeUInt64 GetStartTime();
113 vtkTypeUInt64 GetStopTime();
121
122protected:
125
126 vtkTypeUInt32 StartQuery;
127 vtkTypeUInt32 EndQuery;
128
129 vtkTypeUInt64 StartTime;
130 vtkTypeUInt64 EndTime;
131
134
135private:
137 void operator=(const vtkOpenGLRenderTimer&) = delete;
138};
139
140VTK_ABI_NAMESPACE_END
141#endif // vtkOpenGLRenderTimer_h
142
143// VTK-HeaderTest-Exclude: vtkOpenGLRenderTimer.h
Asynchronously measures GPU execution time for a single event.
void ReusableStart()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
void Reset()
Clear out any previous results and prepare for a new query.
bool Stopped()
Returns true if the timer has been stopped.
bool Started()
Returns true if the timer has been started.
vtkTypeUInt64 GetElapsedNanoseconds()
If Ready() returns true, get the elapsed time in the requested units.
float GetReusableElapsedSeconds()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
void Start()
Mark the start of a timed event.
float GetElapsedMilliseconds()
If Ready() returns true, get the elapsed time in the requested units.
void ReusableStop()
This class can also be used in a reusable manner where the start and stop events stay in flight until...
vtkTypeUInt64 GetStopTime()
If Ready() returns true, return the start or stop time in nanoseconds.
vtkTypeUInt64 GetStartTime()
If Ready() returns true, return the start or stop time in nanoseconds.
void Stop()
Mark the end of a timed event.
float GetElapsedSeconds()
If Ready() returns true, get the elapsed time in the requested units.
void ReleaseGraphicsResources()
Simply calls Reset() to ensure that query ids are freed.
static bool IsSupported()
Returns true if timer events are supported by the current OpenGL implementation.
bool Ready()
Returns true when the timing results are available.