31class EXPCL_PANDA_PUTIL TimeVal {
34 INLINE ulong get_sec()
const;
35 INLINE ulong get_usec()
const;
58class EXPCL_PANDA_PUTIL ClockObject :
public ReferenceCount {
71 ClockObject(Mode mode = M_normal);
72 ClockObject(
const ClockObject ©);
73 INLINE ~ClockObject();
111 MAKE_PROPERTY(average_frame_rate_interval,
129 static void (*_start_clock_wait)();
130 static void (*_start_clock_busy_wait)();
131 static void (*_stop_clock_wait)();
134 void wait_until(
double want_time);
135 static void make_global_clock();
136 static void dummy_clock_wait();
140 double _start_short_time;
141 double _start_long_time;
142 double _actual_frame_time;
144 double _user_frame_rate;
145 double _degrade_factor;
149 double _average_frame_rate_interval;
154 class EXPCL_PANDA_PUTIL CData :
public CycleData {
157 INLINE CData(
const CData ©);
161 return ClockObject::get_class_type();
165 double _reported_frame_time;
166 double _reported_frame_time_epoch;
170 PipelineCycler<CData> _cycler;
171 typedef CycleDataReader<CData> CDReader;
172 typedef CycleDataWriter<CData> CDWriter;
173 typedef CycleDataStageReader<CData> CDStageReader;
175 static AtomicAdjust::Pointer _global_clock;
178 static TypeHandle get_class_type() {
181 static void init_type() {
182 ReferenceCount::init_type();
184 ReferenceCount::get_class_type());
188 static TypeHandle _type_handle;
191EXPCL_PANDA_PUTIL std::ostream &
192operator << (std::ostream &out, ClockObject::Mode mode);
193EXPCL_PANDA_PUTIL std::istream &
194operator >> (std::istream &in, ClockObject::Mode &mode);
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
void set_frame_rate(double frame_rate)
In non-real-time mode, sets the number of frames per second that we should appear to be running.
get_dt
Returns the elapsed time for the previous frame: the number of seconds elapsed between the last two c...
void tick(Thread *current_thread=Thread::get_current_thread())
Instructs the clock that a new frame has just begun.
get_frame_count
Returns the number of times tick() has been called since the ClockObject was created,...
get_real_time
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
set_average_frame_rate_interval
Specifies the interval of time (in seconds) over which get_average_frame_rate() averages the number o...
get_mode
Returns the current mode of the clock.
set_frame_time
Changes the time as reported for the current frame to the indicated time.
set_frame_count
Resets the number of frames counted to the indicated number.
get_long_time
Returns the actual number of seconds elapsed since the ClockObject was created, or since it was last ...
bool check_errors(Thread *current_thread)
Returns true if a clock error was detected since the last time check_errors() was called.
get_max_dt
Returns the current maximum allowable time elapsed between any two frames.
set_real_time
Resets the clock to the indicated time.
get_average_frame_rate_interval
Returns the interval of time (in seconds) over which get_average_frame_rate() averages the number of ...
void sync_frame_time(Thread *current_thread=Thread::get_current_thread())
Resets the frame time to the current real time.
void reset()
Simultaneously resets both the time and the frame count to zero.
set_mode
Changes the mode of the clock.
get_degrade_factor
In degrade mode, returns the ratio by which the performance is degraded.
set_max_dt
Sets a limit on the value returned by get_dt().
double calc_frame_rate_deviation(Thread *current_thread=Thread::get_current_thread()) const
Returns the standard deviation of the frame times of the frames rendered over the past get_average_fr...
get_average_frame_rate
Returns the average frame rate in number of frames per second over the last get_average_frame_rate_in...
set_dt
In non-real-time mode, sets the number of seconds that should appear to elapse between frames.
set_degrade_factor
In degrade mode, sets the ratio by which the performance is degraded.
double get_net_frame_rate(Thread *current_thread=Thread::get_current_thread()) const
Returns the average frame rate since the last reset.
get_max_frame_duration
Returns the maximum frame duration over the last get_average_frame_rate_interval() seconds.
A single page of data maintained by a PipelineCycler.
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
An interface to whatever real-time clock we might have available in the current environment.
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL deque.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.