FrameProfilerGL class new in 2020.06
#include <Magnum/DebugTools/FrameProfiler.h>
OpenGL frame profiler.
A FrameProfiler with OpenGL-specific measurements. Instantiate with a desired subset of measured values and then continue the same way as described in the FrameProfiler usage documentation:
DebugTools::FrameProfilerGL _profiler{ DebugTools::FrameProfilerGL::Value::FrameTime| DebugTools::FrameProfilerGL::Value::GpuDuration, 50};
If none of Value::
Base classes
- class FrameProfiler new in 2020.06
- Frame profiler.
Public types
- enum class Value: UnsignedShort { FrameTime = 1 << 0, CpuDuration = 1 << 1, GpuDuration = 1 << 2, VertexFetchRatio = 1 << 3, PrimitiveClipRatio = 1 << 4 }
- Measured value.
-
using Values = Containers::
EnumSet<Value> - Measured values.
Constructors, destructors, conversion operators
- FrameProfilerGL() explicit
- Default constructor.
- FrameProfilerGL(Values values, UnsignedInt maxFrameCount) explicit
- Constructor.
- FrameProfilerGL(const FrameProfilerGL&) deleted
- Copying is not allowed.
- FrameProfilerGL(FrameProfilerGL&&) noexcept
- Move constructor.
Public functions
- auto operator=(const FrameProfilerGL&) -> FrameProfilerGL& deleted
- Copying is not allowed.
- auto operator=(FrameProfilerGL&&) -> FrameProfilerGL& noexcept
- Move assignment.
- void setup(Values values, UnsignedInt maxFrameCount)
- Setup measured values.
- auto values() const -> Values
- Measured values.
- auto isMeasurementAvailable(Value value) const -> bool
- Whether given measurement is available.
- auto frameTimeMean() const -> Double
- Mean frame time in nanoseconds.
- auto cpuDurationMean() const -> Double
- Mean CPU frame duration in nanoseconds.
- auto gpuDurationMean() const -> Double
- Mean GPU frame duration in nanoseconds.
- auto vertexFetchRatioMean() const -> Double
- Mean vertex fetch ratio in thousandths.
- auto primitiveClipRatioMean() const -> Double
- Mean primitive clip ratio in percentage thousandths.
- auto isMeasurementAvailable(UnsignedInt id) const -> bool
- Whether given measurement is available.
Enum documentation
enum class Magnum:: DebugTools:: FrameProfilerGL:: Value: UnsignedShort
Measured value.
| Enumerators | |
|---|---|
| FrameTime |
Measure total frame time (i.e., time between consecutive beginFrame() calls). Reported in Units:: |
| CpuDuration |
Measure CPU frame duration (i.e., CPU time spent between beginFrame() and endFrame()). Reported in Units:: |
| GpuDuration |
Measure GPU frame duration (i.e., time between beginFrame() and endFrame()). Reported in Units:: |
| VertexFetchRatio |
Ratio of vertex shader invocations to count of vertices submitted. For a non-indexed draw the ratio will be 1, for indexed draws ratio is less than 1. The lower the value is, the better a mesh is optimized for post-transform vertex cache. Reported in Units:: |
| PrimitiveClipRatio |
Ratio of primitives discarded by the clipping stage to count of primitives submitted. The ratio is 0 when all primitives pass the clipping stage and 1 when all are discarded. Can be used to measure efficiency of a frustum culling algorithm. Reported in Units:: |
Typedef documentation
typedef Containers:: EnumSet<Value> Magnum:: DebugTools:: FrameProfilerGL:: Values
Measured values.
Function documentation
Magnum:: DebugTools:: FrameProfilerGL:: FrameProfilerGL() explicit
Default constructor.
Call setup() to populate the profiler with measurements.
Magnum:: DebugTools:: FrameProfilerGL:: FrameProfilerGL(Values values,
UnsignedInt maxFrameCount) explicit
Constructor.
Equivalent to default-constructing an instance and calling setup() afterwards.
void Magnum:: DebugTools:: FrameProfilerGL:: setup(Values values,
UnsignedInt maxFrameCount)
Setup measured values.
| Parameters | |
|---|---|
| values | List of measuremed values |
| maxFrameCount | Max frame count over which to calculate a moving average. Expected to be at least 1. |
Calling setup() on an already set up profiler will replace existing measurements with measurements and reset measuredFrameCount() back to 0.
Values Magnum:: DebugTools:: FrameProfilerGL:: values() const
Measured values.
Corresponds to the values parameter passed to FrameProfilerGL(Values, UnsignedInt) or setup().
bool Magnum:: DebugTools:: FrameProfilerGL:: isMeasurementAvailable(Value value) const
Whether given measurement is available.
Returns true if enough frames was captured to calculate given value, false otherwise. Expects that value was enabled.
Double Magnum:: DebugTools:: FrameProfilerGL:: frameTimeMean() const
Mean frame time in nanoseconds.
Expects that Value::
Double Magnum:: DebugTools:: FrameProfilerGL:: cpuDurationMean() const
Mean CPU frame duration in nanoseconds.
Expects that Value::
Double Magnum:: DebugTools:: FrameProfilerGL:: gpuDurationMean() const
Mean GPU frame duration in nanoseconds.
Expects that Value::
Double Magnum:: DebugTools:: FrameProfilerGL:: vertexFetchRatioMean() const
Mean vertex fetch ratio in thousandths.
Expects that Value::
Double Magnum:: DebugTools:: FrameProfilerGL:: primitiveClipRatioMean() const
Mean primitive clip ratio in percentage thousandths.
Expects that Value::
bool Magnum:: DebugTools:: FrameProfilerGL:: isMeasurementAvailable(UnsignedInt id) const
Whether given measurement is available.
Returns true if measuredFrameCount() is at least measurementDelay() for given id, false otherwise. The id corresponds to the index of the measurement in the list passed to setup(). Expects that id is less than measurementCount().
Debug& operator<<(Debug& debug,
FrameProfilerGL:: Value value) new in 2020.06
Debug output operator.
Debug& operator<<(Debug& debug,
FrameProfilerGL:: Values value) new in 2020.06
Debug output operator.