[][src]Struct qt_gui::QOpenGLTimeMonitor

#[repr(C)]pub struct QOpenGLTimeMonitor { /* fields omitted */ }

The QOpenGLTimeMonitor class wraps a sequence of OpenGL timer query objects.

C++ class: QOpenGLTimeMonitor.

C++ documentation:

The QOpenGLTimeMonitor class wraps a sequence of OpenGL timer query objects.

The QOpenGLTimeMonitor class is a convenience wrapper around a collection of OpenGL timer query objects used to measure intervals of time on the GPU to the level of granularity required by your rendering application.

The OpenGL timer queries objects are queried in sequence to record the GPU timestamps at positions of interest in your rendering code. Once the results for all issues timer queries become available, the results can be fetched and QOpenGLTimerMonitor will calculate the recorded time intervals for you.

The typical use case of this class is to either profile your application's rendering algorithms or to adjust those algorithms in real-time for dynamic performance/quality balancing.

Prior to using QOpenGLTimeMonitor in your rendering function you should set the required number of sample points that you wish to record by calling setSamples(). Note that measuring N sample points will produce N-1 time intervals. Once you have set the number of sample points, call the create() function with a valid current OpenGL context to create the necessary query timer objects. These steps are usually performed just once in an initialization function.

Use the recordSample() function to delimit blocks of code containing OpenGL commands that you wish to time. You can check availability of the resulting time samples and time intervals with isResultAvailable(). The calculated time intervals and the raw timestamp samples can be retrieved with the blocking waitForIntervals() and waitForSamples() functions respectively.

After retrieving the results and before starting a new round of taking samples (for example, in the next frame) be sure to call the reset() function which will clear the cached results and reset the timer index back to the first timer object.

Methods

impl QOpenGLTimeMonitor[src]

pub unsafe fn create(&self) -> bool[src]

Instantiate sampleCount() OpenGL timer query objects that will be used to track the amount of time taken to execute OpenGL commands between successive calls to recordSample().

Calls C++ function: bool QOpenGLTimeMonitor::create().

C++ documentation:

Instantiate sampleCount() OpenGL timer query objects that will be used to track the amount of time taken to execute OpenGL commands between successive calls to recordSample().

Returns true if the OpenGL timer query objects could be created.

See also destroy(), setSampleCount(), and recordSample().

pub unsafe fn destroy(&self)[src]

Destroys any OpenGL timer query objects used within this instance.

Calls C++ function: void QOpenGLTimeMonitor::destroy().

C++ documentation:

Destroys any OpenGL timer query objects used within this instance.

See also create().

pub unsafe fn is_created(&self) -> bool[src]

Returns true if the underlying OpenGL query objects have been created. If this returns true and the associated OpenGL context is current, then you are able to record time samples with this object.

Calls C++ function: bool QOpenGLTimeMonitor::isCreated() const.

C++ documentation:

Returns true if the underlying OpenGL query objects have been created. If this returns true and the associated OpenGL context is current, then you are able to record time samples with this object.

pub unsafe fn is_result_available(&self) -> bool[src]

Returns true if the OpenGL timer query results are available.

Calls C++ function: bool QOpenGLTimeMonitor::isResultAvailable() const.

C++ documentation:

Returns true if the OpenGL timer query results are available.

See also waitForSamples() and waitForIntervals().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QOpenGLTimeMonitor::metaObject() const.

pub unsafe fn new_1a(
    parent: impl CastInto<Ptr<QObject>>
) -> QBox<QOpenGLTimeMonitor>
[src]

Creates a QOpenGLTimeMonitor instance with the given parent. You must call create() with a valid OpenGL context before using.

Calls C++ function: [constructor] void QOpenGLTimeMonitor::QOpenGLTimeMonitor(QObject* parent = …).

C++ documentation:

Creates a QOpenGLTimeMonitor instance with the given parent. You must call create() with a valid OpenGL context before using.

See also setSampleCount() and create().

pub unsafe fn new_0a() -> QBox<QOpenGLTimeMonitor>[src]

The QOpenGLTimeMonitor class wraps a sequence of OpenGL timer query objects.

Calls C++ function: [constructor] void QOpenGLTimeMonitor::QOpenGLTimeMonitor().

C++ documentation:

The QOpenGLTimeMonitor class wraps a sequence of OpenGL timer query objects.

The QOpenGLTimeMonitor class is a convenience wrapper around a collection of OpenGL timer query objects used to measure intervals of time on the GPU to the level of granularity required by your rendering application.

The OpenGL timer queries objects are queried in sequence to record the GPU timestamps at positions of interest in your rendering code. Once the results for all issues timer queries become available, the results can be fetched and QOpenGLTimerMonitor will calculate the recorded time intervals for you.

The typical use case of this class is to either profile your application's rendering algorithms or to adjust those algorithms in real-time for dynamic performance/quality balancing.

Prior to using QOpenGLTimeMonitor in your rendering function you should set the required number of sample points that you wish to record by calling setSamples(). Note that measuring N sample points will produce N-1 time intervals. Once you have set the number of sample points, call the create() function with a valid current OpenGL context to create the necessary query timer objects. These steps are usually performed just once in an initialization function.

Use the recordSample() function to delimit blocks of code containing OpenGL commands that you wish to time. You can check availability of the resulting time samples and time intervals with isResultAvailable(). The calculated time intervals and the raw timestamp samples can be retrieved with the blocking waitForIntervals() and waitForSamples() functions respectively.

After retrieving the results and before starting a new round of taking samples (for example, in the next frame) be sure to call the reset() function which will clear the cached results and reset the timer index back to the first timer object.

pub unsafe fn object_ids(&self) -> CppBox<QVectorOfU32>[src]

Returns a QVector containing the object Ids of the OpenGL timer query objects.

Calls C++ function: QVector<GLuint> QOpenGLTimeMonitor::objectIds() const.

C++ documentation:

Returns a QVector containing the object Ids of the OpenGL timer query objects.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QOpenGLTimeMonitor::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QOpenGLTimeMonitor::qt_metacast(const char* arg1).

pub unsafe fn record_sample(&self) -> c_int[src]

Issues an OpenGL timer query at this point in the OpenGL command queue. Calling this function in a sequence in your application's rendering function, will build up details of the GPU time taken to execute the OpenGL commands between successive calls to this function.

Calls C++ function: int QOpenGLTimeMonitor::recordSample().

C++ documentation:

Issues an OpenGL timer query at this point in the OpenGL command queue. Calling this function in a sequence in your application's rendering function, will build up details of the GPU time taken to execute the OpenGL commands between successive calls to this function.

See also setSampleCount(), isResultAvailable(), waitForSamples(), and waitForIntervals().

pub unsafe fn reset(&self)[src]

Resets the time monitor ready for use in another frame of rendering. Call this once you have obtained the previous results and before calling recordSample() for the first time on the next frame.

Calls C++ function: void QOpenGLTimeMonitor::reset().

C++ documentation:

Resets the time monitor ready for use in another frame of rendering. Call this once you have obtained the previous results and before calling recordSample() for the first time on the next frame.

See also recordSample().

pub unsafe fn sample_count(&self) -> c_int[src]

Returns the number of sample points that have been requested with setSampleCount(). If create was successfully called following setSampleCount(), then the value returned will be the actual number of sample points that can be used.

Calls C++ function: int QOpenGLTimeMonitor::sampleCount() const.

C++ documentation:

Returns the number of sample points that have been requested with setSampleCount(). If create was successfully called following setSampleCount(), then the value returned will be the actual number of sample points that can be used.

The default value for sample count is 2, leading to the measurement of a single interval.

See also setSampleCount().

pub unsafe fn set_sample_count(&self, sample_count: c_int)[src]

Sets the number of sample points to sampleCount. After setting the number of samples with this function, you must call create() to instantiate the underlying OpenGL timer query objects.

Calls C++ function: void QOpenGLTimeMonitor::setSampleCount(int sampleCount).

C++ documentation:

Sets the number of sample points to sampleCount. After setting the number of samples with this function, you must call create() to instantiate the underlying OpenGL timer query objects.

The new sampleCount must be at least 2.

See also sampleCount(), create(), and recordSample().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QOpenGLTimeMonitor::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QOpenGLTimeMonitor::trUtf8(const char* s, const char* c, int n).

pub unsafe fn wait_for_intervals(&self) -> CppBox<QVectorOfU64>[src]

Returns a QVector containing the time intervals delimited by the calls to recordSample(). The resulting vector will contain one fewer element as this represents the intervening intervals rather than the actual timestamp samples.

Calls C++ function: QVector<GLuint64> QOpenGLTimeMonitor::waitForIntervals() const.

C++ documentation:

Returns a QVector containing the time intervals delimited by the calls to recordSample(). The resulting vector will contain one fewer element as this represents the intervening intervals rather than the actual timestamp samples.

This function will block until OpenGL indicates the results are available. It is recommended to check the availability of the result prior to calling this function with isResultAvailable().

See also waitForSamples() and isResultAvailable().

pub unsafe fn wait_for_samples(&self) -> CppBox<QVectorOfU64>[src]

Returns a QVector containing the GPU timestamps taken with recordSample().

Calls C++ function: QVector<GLuint64> QOpenGLTimeMonitor::waitForSamples() const.

C++ documentation:

Returns a QVector containing the GPU timestamps taken with recordSample().

This function will block until OpenGL indicates the results are available. It is recommended to check the availability of the result prior to calling this function with isResultAvailable().

Note: This function only works on systems that have OpenGL >=3.3 or the ARB_timer_query extension. See QOpenGLTimerQuery for more details.

See also waitForIntervals() and isResultAvailable().

Trait Implementations

impl CppDeletable for QOpenGLTimeMonitor[src]

unsafe fn delete(&self)[src]

Destroys the QOpenGLTimeMonitor and any underlying OpenGL resources.

Calls C++ function: virtual [destructor] void QOpenGLTimeMonitor::~QOpenGLTimeMonitor().

C++ documentation:

Destroys the QOpenGLTimeMonitor and any underlying OpenGL resources.

impl Deref for QOpenGLTimeMonitor[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QOpenGLTimeMonitor* ptr).

impl DynamicCast<QOpenGLTimeMonitor> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QOpenGLTimeMonitor>[src]

Calls C++ function: QOpenGLTimeMonitor* dynamic_cast<QOpenGLTimeMonitor*>(QObject* ptr).

impl StaticDowncast<QOpenGLTimeMonitor> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QOpenGLTimeMonitor>[src]

Calls C++ function: QOpenGLTimeMonitor* static_cast<QOpenGLTimeMonitor*>(QObject* ptr).

impl StaticUpcast<QObject> for QOpenGLTimeMonitor[src]

unsafe fn static_upcast(ptr: Ptr<QOpenGLTimeMonitor>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QOpenGLTimeMonitor* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.