|
VTK
|
Asynchronously measures GPU execution time. More...
#include <vtkOpenGLRenderTimer.h>
Public Member Functions | |
| vtkOpenGLRenderTimer () | |
| ~vtkOpenGLRenderTimer () | |
| void | Reset () |
| Clear out any previous results and prepare for a new query. More... | |
| void | Start () |
| Mark the start of a timed event. More... | |
| void | Stop () |
| Mark the end of a timed event. More... | |
| bool | Started () |
| Returns true if the timer has been started. More... | |
| bool | Stopped () |
| Returns true if the timer has been stopped. More... | |
| bool | Ready () |
| Returns true when the timing results are available. More... | |
| void | ReleaseGraphicsResources () |
| Simply calls Reset() to ensure that query ids are freed. More... | |
| float | GetElapsedSeconds () |
| If Ready() returns true, get the elapsed time in the requested units. More... | |
| float | GetElapsedMilliseconds () |
| If Ready() returns true, get the elapsed time in the requested units. More... | |
| vtkTypeUInt64 | GetElapsedNanoseconds () |
| If Ready() returns true, get the elapsed time in the requested units. More... | |
| void | ReusableStart () |
| This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed. More... | |
| void | ReusableStop () |
| This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed. More... | |
| float | GetReusableElapsedSeconds () |
| This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed. More... | |
Protected Attributes | |
| bool | StartReady |
| bool | EndReady |
| vtkTypeUInt32 | StartQuery |
| vtkTypeUInt32 | EndQuery |
| vtkTypeUInt64 | StartTime |
| vtkTypeUInt64 | EndTime |
| bool | ReusableStarted |
| bool | ReusableEnded |
Asynchronously measures GPU execution time.
This class posts events to the OpenGL server to measure execution times of GPU processes. The queries are asynchronous and multiple vtkOpenGLRenderTimers may overlap / be nested.
This uses GL_TIMESTAMP rather than GL_ELAPSED_TIME, since only one GL_ELAPSED_TIME query may be active at a time. Since GL_TIMESTAMP is not available on OpenGL ES2
Definition at line 36 of file vtkOpenGLRenderTimer.h.
| vtkOpenGLRenderTimer::vtkOpenGLRenderTimer | ( | ) |
| vtkOpenGLRenderTimer::~vtkOpenGLRenderTimer | ( | ) |
| void vtkOpenGLRenderTimer::Reset | ( | ) |
Clear out any previous results and prepare for a new query.
| void vtkOpenGLRenderTimer::Start | ( | ) |
Mark the start of a timed event.
| void vtkOpenGLRenderTimer::Stop | ( | ) |
Mark the end of a timed event.
| bool vtkOpenGLRenderTimer::Started | ( | ) |
Returns true if the timer has been started.
The query may not be ready yet.
| bool vtkOpenGLRenderTimer::Stopped | ( | ) |
Returns true if the timer has been stopped.
The query may not be ready yet.
| bool vtkOpenGLRenderTimer::Ready | ( | ) |
Returns true when the timing results are available.
| float vtkOpenGLRenderTimer::GetElapsedSeconds | ( | ) |
If Ready() returns true, get the elapsed time in the requested units.
| float vtkOpenGLRenderTimer::GetElapsedMilliseconds | ( | ) |
If Ready() returns true, get the elapsed time in the requested units.
| vtkTypeUInt64 vtkOpenGLRenderTimer::GetElapsedNanoseconds | ( | ) |
If Ready() returns true, get the elapsed time in the requested units.
| void vtkOpenGLRenderTimer::ReusableStart | ( | ) |
This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed.
Calling ReusableStart while they are in flight is ignored. The Elapsed time is always the result from the most recently completed flight. Typical usage is
render loop timer->ReusableStart(); // do some rendering timer->ReusableStop(); time = timer->GetReusableElapsedSeconds();
the elapsed seconds will return zero until a flight has completed.
The idea being that with OpenGL render commands are asynchronous. You might render multiple times before the first render on the GPU is completed. These reusable methods provide a method for provinding a constant measure of the time required for a command with the efficiency of only having one timing in process/flight at a time. Making this a lightweight timer in terms of OpenGL API calls.
These reusable methods are not meant to be mixed with other methods in this class.
| void vtkOpenGLRenderTimer::ReusableStop | ( | ) |
This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed.
Calling ReusableStart while they are in flight is ignored. The Elapsed time is always the result from the most recently completed flight. Typical usage is
render loop timer->ReusableStart(); // do some rendering timer->ReusableStop(); time = timer->GetReusableElapsedSeconds();
the elapsed seconds will return zero until a flight has completed.
The idea being that with OpenGL render commands are asynchronous. You might render multiple times before the first render on the GPU is completed. These reusable methods provide a method for provinding a constant measure of the time required for a command with the efficiency of only having one timing in process/flight at a time. Making this a lightweight timer in terms of OpenGL API calls.
These reusable methods are not meant to be mixed with other methods in this class.
| float vtkOpenGLRenderTimer::GetReusableElapsedSeconds | ( | ) |
This class can also be used in a reusable manner where the start and stop events stay in flight until they are both completed.
Calling ReusableStart while they are in flight is ignored. The Elapsed time is always the result from the most recently completed flight. Typical usage is
render loop timer->ReusableStart(); // do some rendering timer->ReusableStop(); time = timer->GetReusableElapsedSeconds();
the elapsed seconds will return zero until a flight has completed.
The idea being that with OpenGL render commands are asynchronous. You might render multiple times before the first render on the GPU is completed. These reusable methods provide a method for provinding a constant measure of the time required for a command with the efficiency of only having one timing in process/flight at a time. Making this a lightweight timer in terms of OpenGL API calls.
These reusable methods are not meant to be mixed with other methods in this class.
| void vtkOpenGLRenderTimer::ReleaseGraphicsResources | ( | ) |
Simply calls Reset() to ensure that query ids are freed.
All stored timing information will be lost.
|
protected |
Definition at line 119 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 120 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 122 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 123 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 125 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 126 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 128 of file vtkOpenGLRenderTimer.h.
|
protected |
Definition at line 129 of file vtkOpenGLRenderTimer.h.
1.8.13