49 CDReader cdata(_cycler, current_frame);
50 return cdata->_reported_frame_time;
69 return (_true_clock->get_short_time() - _start_short_time);
88 return (_true_clock->get_long_time() - _start_long_time);
114 CDReader cdata(_cycler, current_thread);
115 return cdata->_frame_count;
129 CDReader cdata(_cycler, current_thread);
130 return (
double)cdata->_frame_count / cdata->_reported_frame_time;
142 CDReader cdata(_cycler, current_thread);
144 return min(_max_dt, cdata->_dt);
194 return _degrade_factor;
209 _degrade_factor = degrade_factor;
227 _average_frame_rate_interval = time;
228 if (_average_frame_rate_interval == 0.0) {
242 return _average_frame_rate_interval;
257 CDReader cdata(_cycler, current_thread);
258 int orig_error_count = _error_count;
260 return (_error_count != orig_error_count);
275 return _global_clock;
283 INLINE ClockObject::CData::
284 CData(
const ClockObject::CData ©) :
285 _frame_count(copy._frame_count),
286 _reported_frame_time(copy._reported_frame_time),
305 INLINE ulong TimeVal::
315 INLINE ulong TimeVal::
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
void set_degrade_factor(double degrade_factor)
In degrade mode, sets the ratio by which the performance is degraded.
void set_frame_time(double time, Thread *current_thread=Thread::get_current_thread())
Changes the time as reported for the current frame to the indicated time.
double get_degrade_factor() const
In degrade mode, returns the ratio by which the performance is degraded.
void set_average_frame_rate_interval(double time)
Specifies the interval of time (in seconds) over which get_average_frame_rate() averages the number o...
double get_net_frame_rate(Thread *current_thread=Thread::get_current_thread()) const
Returns the average frame rate since the last reset.
double get_frame_time(Thread *current_thread=Thread::get_current_thread()) const
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
double get_long_time() const
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
double get_average_frame_rate_interval() const
Returns the interval of time (in seconds) over which get_average_frame_rate() averages the number of ...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
void set_max_dt(double max_dt)
Sets a limit on the value returned by get_dt().
void set_real_time(double time)
Resets the clock to the indicated time.
int get_frame_count(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of times tick() has been called since the ClockObject was created, or since it was last reset.
A ClockObject keeps track of elapsed real time and discrete time.
double get_real_time() const
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
Mode get_mode() const
Returns the current mode of the clock.
double get_max_dt() const
Returns the current maximum allowable time elapsed between any two frames.
void set_frame_count(int frame_count, Thread *current_thread=Thread::get_current_thread())
Resets the number of frames counted to the indicated number.
A thread; that is, a lightweight process.
int get_error_count() const
Returns the number of clock errors that have been detected.
bool check_errors(Thread *current_thread)
Returns true if a clock error was detected since the last time check_errors() was called...
void reset()
Simultaneously resets both the time and the frame count to zero.
double get_dt(Thread *current_thread=Thread::get_current_thread()) const
Returns the elapsed time for the previous frame: the number of seconds elapsed between the last two c...