QtBase  v6.3.1
Classes | Public Types | Public Member Functions | Friends | List of all members
QRhiProfiler Class Reference

#include <qrhiprofiler_p.h>

Classes

class  CpuTime
 
class  GpuTime
 

Public Types

enum  StreamOp {
  NewBuffer = 1 , ReleaseBuffer , NewBufferStagingArea , ReleaseBufferStagingArea ,
  NewRenderBuffer , ReleaseRenderBuffer , NewTexture , ReleaseTexture ,
  NewTextureStagingArea , ReleaseTextureStagingArea , ResizeSwapChain , ReleaseSwapChain ,
  NewReadbackBuffer , ReleaseReadbackBuffer , GpuMemAllocStats , GpuFrameTime ,
  FrameToFrameTime , FrameBuildTime
}
 

Public Member Functions

 ~QRhiProfiler ()
 
void setDevice (QIODevice *device)
 
void addVMemAllocatorStats ()
 
int frameTimingWriteInterval () const
 
void setFrameTimingWriteInterval (int frameCount)
 
CpuTime frameToFrameTimes (QRhiSwapChain *sc) const
 
CpuTime frameBuildTimes (QRhiSwapChain *sc) const
 
GpuTime gpuFrameTimes (QRhiSwapChain *sc) const
 

Friends

class QRhiImplementation
 
class QRhiProfilerPrivate
 

Detailed Description

Definition at line 61 of file qrhiprofiler_p.h.

Member Enumeration Documentation

◆ StreamOp

Describes an entry in the profiler's output stream.

\value NewBuffer A buffer is created \value ReleaseBuffer A buffer is destroyed \value NewBufferStagingArea A staging buffer for buffer upload is created \value ReleaseBufferStagingArea A staging buffer for buffer upload is destroyed \value NewRenderBuffer A renderbuffer is created \value ReleaseRenderBuffer A renderbuffer is destroyed \value NewTexture A texture is created \value ReleaseTexture A texture is destroyed \value NewTextureStagingArea A staging buffer for texture upload is created \value ReleaseTextureStagingArea A staging buffer for texture upload is destroyed \value ResizeSwapChain A swapchain is created or resized \value ReleaseSwapChain A swapchain is destroyed \value NewReadbackBuffer A staging buffer for readback is created \value ReleaseReadbackBuffer A staging buffer for readback is destroyed \value GpuMemAllocStats GPU memory allocator statistics \value GpuFrameTime GPU frame times \value FrameToFrameTime CPU frame-to-frame times \value FrameBuildTime CPU beginFrame-endFrame times

Enumerator
NewBuffer 
ReleaseBuffer 
NewBufferStagingArea 
ReleaseBufferStagingArea 
NewRenderBuffer 
ReleaseRenderBuffer 
NewTexture 
ReleaseTexture 
NewTextureStagingArea 
ReleaseTextureStagingArea 
ResizeSwapChain 
ReleaseSwapChain 
NewReadbackBuffer 
ReleaseReadbackBuffer 
GpuMemAllocStats 
GpuFrameTime 
FrameToFrameTime 
FrameBuildTime 

Definition at line 64 of file qrhiprofiler_p.h.

Constructor & Destructor Documentation

◆ ~QRhiProfiler()

QRhiProfiler::~QRhiProfiler ( )

Destructor.

Definition at line 188 of file qrhiprofiler.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addVMemAllocatorStats()

void QRhiProfiler::addVMemAllocatorStats ( )

Requests writing a GpuMemAllocStats entry into the output, when applicable. Backends that do not support this will ignore the request. This is an explicit request since getting the allocator status and statistics may be an expensive operation.

Definition at line 214 of file qrhiprofiler.cpp.

Here is the call graph for this function:

◆ frameBuildTimes()

QRhiProfiler::CpuTime QRhiProfiler::frameBuildTimes ( QRhiSwapChain sc) const
Returns
min, max, and avg in milliseconds for the time that elapsed between a QRhi::beginFrame() and QRhi::endFrame().
Note
The values are all 0 until at least frameTimingWriteInterval() frames have been rendered.

Definition at line 264 of file qrhiprofiler.cpp.

◆ frameTimingWriteInterval()

int QRhiProfiler::frameTimingWriteInterval ( ) const
Returns
the currently set frame timing writeout interval.

Definition at line 223 of file qrhiprofiler.cpp.

◆ frameToFrameTimes()

QRhiProfiler::CpuTime QRhiProfiler::frameToFrameTimes ( QRhiSwapChain sc) const
Returns
min, max, and avg in milliseconds for the time that elapsed between two QRhi::endFrame() calls.
Note
The values are all 0 until at least frameTimingWriteInterval() frames have been rendered.

Definition at line 248 of file qrhiprofiler.cpp.

◆ gpuFrameTimes()

QRhiProfiler::GpuTime QRhiProfiler::gpuFrameTimes ( QRhiSwapChain sc) const
Returns
min, max, and avg in milliseconds for the GPU time that is spent on one frame.
Note
The values are all 0 until at least frameTimingWriteInterval() frames have been rendered.

The GPU times should only be compared between runs on the same GPU of the same system with the same backend. Comparing times for different graphics cards or for different backends can give misleading results. The numbers are not meant to be comparable that way.

Note
Some backends have no support for this, and even for those that have, it is not guaranteed that the driver will support it at run time. Support can be checked via QRhi::Timestamps.

Definition at line 289 of file qrhiprofiler.cpp.

◆ setDevice()

void QRhiProfiler::setDevice ( QIODevice device)

Sets the output device.

Note
No output will be generated when QRhi::EnableProfiling was not set.

Definition at line 203 of file qrhiprofiler.cpp.

◆ setFrameTimingWriteInterval()

void QRhiProfiler::setFrameTimingWriteInterval ( int  frameCount)

Sets the number of frames that need to be rendered before the collected CPU and GPU timings are processed (min, max, average are calculated) to frameCount.

The default value is 120.

Definition at line 235 of file qrhiprofiler.cpp.

Friends And Related Function Documentation

◆ QRhiImplementation

friend class QRhiImplementation
friend

Definition at line 114 of file qrhiprofiler_p.h.

◆ QRhiProfilerPrivate

friend class QRhiProfilerPrivate
friend

Definition at line 115 of file qrhiprofiler_p.h.


The documentation for this class was generated from the following files: