VTK  9.1.0
vtkOpenGLRenderTimer.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOpenGLRenderTimer.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
31#ifndef vtkOpenGLRenderTimer_h
32#define vtkOpenGLRenderTimer_h
33
34#include "vtkRenderingOpenGL2Module.h" // For export macro
35#include "vtkType.h" // For vtkTypeUint64, etc
36
37class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimer
38{
39public:
42
47 static bool IsSupported();
48
52 void Reset();
53
57 void Start();
58
62 void Stop();
63
67 bool Started();
68
72 bool Stopped();
73
77 bool Ready();
78
80
85 vtkTypeUInt64 GetElapsedNanoseconds();
87
89
118
123 vtkTypeUInt64 GetStartTime();
124 vtkTypeUInt64 GetStopTime();
132
133protected:
136
137 vtkTypeUInt32 StartQuery;
138 vtkTypeUInt32 EndQuery;
139
140 vtkTypeUInt64 StartTime;
141 vtkTypeUInt64 EndTime;
142
145
146private:
148 void operator=(const vtkOpenGLRenderTimer&) = delete;
149};
150
151#endif // vtkOpenGLRenderTimer_h
152
153// 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.