#include <RenderTimer.h>

Public Types

enum  Type { FastRender, SlowRender, NoTimeout }
 

Public Member Functions

 RenderTimer (Type t)
 Create a new RenderTimer and start timing. More...
 
bool outOfTime (double fractionComplete)
 Return true if we have run out of time and should suspend rendering and handle user events instead. More...
 
double secondsPerItem (int itemsRendered) const
 

Private Attributes

std::chrono::time_point< std::chrono::steady_clock > m_start
 
bool m_haveLimits
 
double m_minFraction
 
double m_softLimit
 
double m_hardLimit
 
bool m_softLimitOverridden
 

Detailed Description

Definition at line 20 of file RenderTimer.h.

Member Enumeration Documentation

Enumerator
FastRender 

A normal rendering operation with normal responsiveness demands.

SlowRender 

An operation that the user might accept being slower.

NoTimeout 

An operation that should always complete, i.e.

as if there were no RenderTimer in use, but without having to change client code structurally

Definition at line 23 of file RenderTimer.h.

Constructor & Destructor Documentation

RenderTimer::RenderTimer ( Type  t)
inline

Create a new RenderTimer and start timing.

Make one of these before rendering, and then call outOfTime() regularly during rendering. If outOfTime() returns true, abandon rendering! and schedule the rest for after some user responsiveness has happened.

Definition at line 43 of file RenderTimer.h.

References m_hardLimit, m_haveLimits, m_softLimit, NoTimeout, and SlowRender.

Member Function Documentation

bool RenderTimer::outOfTime ( double  fractionComplete)
inline

Return true if we have run out of time and should suspend rendering and handle user events instead.

Call this regularly during rendering work: fractionComplete should be an estimate of how much of the work has been done as of this call, as a number between 0.0 (none of it) and 1.0 (all of it).

Definition at line 67 of file RenderTimer.h.

References m_hardLimit, m_haveLimits, m_minFraction, m_softLimit, m_softLimitOverridden, and m_start.

Referenced by Colour3DPlotRenderer::renderDrawBuffer(), and Colour3DPlotRenderer::renderDrawBufferPeakFrequencies().

double RenderTimer::secondsPerItem ( int  itemsRendered) const
inline

Definition at line 93 of file RenderTimer.h.

References m_start.

Referenced by Colour3DPlotRenderer::updateTimings().

Member Data Documentation

std::chrono::time_point<std::chrono::steady_clock> RenderTimer::m_start
private

Definition at line 104 of file RenderTimer.h.

Referenced by outOfTime(), and secondsPerItem().

bool RenderTimer::m_haveLimits
private

Definition at line 105 of file RenderTimer.h.

Referenced by outOfTime(), and RenderTimer().

double RenderTimer::m_minFraction
private

Definition at line 106 of file RenderTimer.h.

Referenced by outOfTime().

double RenderTimer::m_softLimit
private

Definition at line 107 of file RenderTimer.h.

Referenced by outOfTime(), and RenderTimer().

double RenderTimer::m_hardLimit
private

Definition at line 108 of file RenderTimer.h.

Referenced by outOfTime(), and RenderTimer().

bool RenderTimer::m_softLimitOverridden
private

Definition at line 109 of file RenderTimer.h.

Referenced by outOfTime().


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