24 INLINE ClockObject::Mode ClockObject::
39 CDReader cdata(_cycler, current_frame);
40 return cdata->_reported_frame_time;
52 INLINE
double ClockObject::
53 get_real_time()
const {
54 return (_true_clock->get_short_time() - _start_short_time);
67 INLINE
double ClockObject::
68 get_long_time()
const {
69 return (_true_clock->get_long_time() - _start_long_time);
89 CDReader cdata(_cycler, current_thread);
90 return cdata->_frame_count;
101 CDReader cdata(_cycler, current_thread);
102 return (
double)cdata->_frame_count / cdata->_reported_frame_time;
111 CDReader cdata(_cycler, current_thread);
113 return std::min(_max_dt, cdata->_dt);
122 INLINE
double ClockObject::
151 INLINE
double ClockObject::
152 get_degrade_factor()
const {
153 return _degrade_factor;
165 _degrade_factor = degrade_factor;
179 _average_frame_rate_interval = time;
180 if (_average_frame_rate_interval == 0.0) {
190 INLINE
double ClockObject::
191 get_average_frame_rate_interval()
const {
192 return _average_frame_rate_interval;
204 CDReader cdata(_cycler, current_thread);
205 int orig_error_count = _error_count;
207 return (_error_count != orig_error_count);
217 if (UNLIKELY(clock ==
nullptr)) {
227 INLINE ClockObject::CData::
228 CData(
const ClockObject::CData ©) :
229 _frame_count(copy._frame_count),
230 _reported_frame_time(copy._reported_frame_time),
245 INLINE ulong TimeVal::
253 INLINE ulong TimeVal::
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
static Pointer get_ptr(const Pointer &var)
Atomically retrieves the snapshot value of the indicated variable.
set_real_time
Resets the clock to the indicated time.
double get_net_frame_rate(Thread *current_thread=Thread::get_current_thread()) const
Returns the average frame rate since the last reset.
set_max_dt
Sets a limit on the value returned by get_dt().
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
set_average_frame_rate_interval
Specifies the interval of time (in seconds) over which get_average_frame_rate() averages the number o...
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
get_frame_count
Returns the number of times tick() has been called since the ClockObject was created,...
A ClockObject keeps track of elapsed real time and discrete time.
get_error_count
Returns the number of clock errors that have been detected.
set_frame_count
Resets the number of frames counted to the indicated number.
A thread; that is, a lightweight process.
set_degrade_factor
In degrade mode, sets the ratio by which the performance is degraded.
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.
set_frame_time
Changes the time as reported for the current frame to the indicated time.
get_dt
Returns the elapsed time for the previous frame: the number of seconds elapsed between the last two c...