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:
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:
124  bool EndReady;
125 
126  vtkTypeUInt32 StartQuery;
127  vtkTypeUInt32 EndQuery;
128 
129  vtkTypeUInt64 StartTime;
130  vtkTypeUInt64 EndTime;
131 
134 
135 private:
137  void operator=(const vtkOpenGLRenderTimer&) = delete;
138 };
139 
140 VTK_ABI_NAMESPACE_END
141 #endif // vtkOpenGLRenderTimer_h
142 
143 // VTK-HeaderTest-Exclude: vtkOpenGLRenderTimer.h
Asynchronously measures GPU execution time for a single event.