NvGPUTimer Class Reference
Accurate timning of GPU operations. More...
#include <NvTimers.h>
Public Member Functions | |
NvGPUTimer () | |
Creates a stopped, zeroed timer; need not be called with a bound OpenGL context. | |
void | init () |
Initializes the OpenGL parts of the timer. | |
void | reset () |
Resets the elapsed time and count of start/stop calls to zero. | |
void | start () |
Starts the timer (the next OpenGL call will be the first timed). | |
void | stop () |
Starts the timer (the previous OpenGL call will be the last timed). | |
int32_t | getStartStopCycles () |
Get the number of start/stop cycles whose values have been accumulated since the last reset. | |
float | getScaledCycles () |
Get the amount of time accumulated for start/stop cycles that have completed since the last reset. | |
Static Public Member Functions | |
static void | globalInit (NvGLExtensionsAPI &api) |
Static initialization of the GPU timer extensions. |
Detailed Description
Accurate timning of GPU operations.Because the GPU is a based on an asynchronously processed command stream that is implicitly generated by OpenGL calls, it is not possible to determine the amount of time spent processing a set of OpenGL calls by timing the calls themselves at the application level. Instead, the timing must be done via an asynchronous timer system. These timers are started and stopped at the beginning and end of the OpenGL commands of interest. However, the timings results must be queried at some point later, as the pipeline must complete before the timer values are known. This class implements a set of multiple timers to allow several start/stop instances to be "in flight"
Member Function Documentation
float NvGPUTimer::getScaledCycles | ( | ) | [inline] |
Get the amount of time accumulated for start/stop cycles that have completed since the last reset.
This value may be lower than the time for all call pairs to start/stop since the last reset, as this value does not take into account the start/stop cycles that are still "in flight" (awaiting results).
- Returns:
- the accumulated time of completed start/stop cycles since the last reset
int32_t NvGPUTimer::getStartStopCycles | ( | ) | [inline] |
Get the number of start/stop cycles whose values have been accumulated since the last reset.
This value may be lower than the number of call pairs to start/stop, as this value does not take into account the start/stop cycles that are still "in flight" (awaiting results).
- Returns:
- the number of start/stop cycles represented in the current accumulated time
static void NvGPUTimer::globalInit | ( | NvGLExtensionsAPI & | api | ) | [static] |
Static initialization of the GPU timer extensions.
Must be called with the intended OpenGL context bound.
- Parameters:
-
[in] api the OpenGL extensions retrieval interface object
void NvGPUTimer::init | ( | ) | [inline] |
Initializes the OpenGL parts of the timer.
This function must be called from a thread that has the OpenGL context to be used bound
void NvGPUTimer::start | ( | ) | [inline] |
Starts the timer (the next OpenGL call will be the first timed).
This must be called from a thread with the OpenGL context bound
void NvGPUTimer::stop | ( | ) | [inline] |
Starts the timer (the previous OpenGL call will be the last timed).
This must be called from a thread with the OpenGL context bound
The documentation for this class was generated from the following file: