Skip to content

PythonQt.Qt.QOpenGLTimerQuery

QOpenGLTimerQuery

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

OpenGL timer query objects are OpenGL managed resources to measure the execution times of sequences of OpenGL commands on the GPU.

OpenGL offers various levels of support for timer queries, depending on the version of OpenGL you have and the presence of the ARB_timer_query or EXT_timer_query extensions. The support can be summarized as:

  • OpenGL >\=3.3 offers full support for all timer query functionality.
  • OpenGL 3.2 with the ARB_timer_query extension offers full support for all timer query functionality.
  • OpenGL \<\=3.2 with the EXT_timer_query extension offers limited support in that the timestamp of the GPU cannot be queried. Places where this impacts functions provided by Qt classes will be highlighted in the function documentation.
  • OpenGL ES 2 (and OpenGL ES 3) do not provide any support for OpenGL timer queries.

OpenGL represents time with a granularity of 1 nanosecond (1e-9 seconds). As a consequence of this, 32-bit integers would only give a total possible duration of approximately 4 seconds, which would not be difficult to exceed in poorly performing or lengthy operations. OpenGL therefore uses 64 bit integer types to represent times. A GLuint64 variable has enough width to contain a duration of hundreds of years, which is plenty for real-time rendering needs.

As with the other Qt OpenGL classes, QOpenGLTimerQuery has a create() function to create the underlying OpenGL object. This is to allow the developer to ensure that there is a valid current OpenGL context at the time.

Once created, timer queries can be issued in one of several ways. The simplest method is to delimit a block of commands with calls to begin() and end(). This instructs OpenGL to measure the time taken from completing all commands issued prior to begin() until the completion of all commands issued prior to end().

At the end of a frame we can retrieve the results by calling waitForResult(). As this function's name implies, it blocks CPU execution until OpenGL notifies that the timer query result is available. To avoid blocking, you can check if the query result is available by calling isResultAvailable(). Note that modern GPUs are deeply pipelined and query results may not become available for between 1-5 frames after they were issued.

Note that OpenGL does not permit nesting or interleaving of multiple timer queries using begin() and end(). Using multiple timer queries and recordTimestamp() avoids this limitation. When using recordTimestamp() the result can be obtained at some later time using isResultAvailable() and waitForResult(). Qt provides the convenience class QOpenGLTimeMonitor that helps with using multiple query objects.

Source: https://doc.qt.io/archives/qt-5.15/qopengltimerquery.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
begin function (self) -> None Marks the start point in the OpenGL command queue for a sequence of commands to be timed by this query object. (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
create function (self) -> bool X.create() -> bool (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroy function (self) -> None Destroys the underlying OpenGL timer query object. (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLTimerQuery.destroyed; argument details are not documented.
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
end function (self) -> None Marks the end point in the OpenGL command queue for a sequence of commands to be timed by this query object. (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isCreated function (self) -> bool X.isCreated() -> bool (shared captured text)
isResultAvailable function (self) -> bool X.isResultAvailable() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
objectId function (self) -> int X.objectId() -> int (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLTimerQuery.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
recordTimestamp function (self) -> None Places a marker in the OpenGL command queue for the GPU to record the timestamp when this marker is reached by the GPU. (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
waitForResult function (self) -> int Returns the result of the OpenGL timer query. (shared captured text)
waitForTimestamp function (self) -> int Returns the current timestamp of the GPU when all previously issued OpenGL commands have been received but not necessarily executed by the GPU. (shared captured text)