Panda3D
|
A collection of FrameData structures for recently-received frames within a particular thread. More...
#include "pStatThreadData.h"
Public Member Functions | |
PStatThreadData (const PStatClientData *client_data) | |
const PStatClientData * | get_client_data () const |
Returns a pointer to the ClientData structure associated with this data. More... | |
bool | get_elapsed_frames (int &then_i, int &now_i) const |
Computes the oldest frame number not older than pstats_average_time seconds, and the newest frame number. More... | |
const PStatFrameData & | get_frame (int frame_number) const |
Returns a FrameData structure associated with the indicated frame number. More... | |
const PStatFrameData & | get_frame_at_time (double time) const |
Returns the FrameData structure associated with the latest frame not later than the indicated time. More... | |
int | get_frame_number_at_time (double time, int hint=-1) const |
Returns the frame number of the latest frame not later than the indicated time. More... | |
double | get_frame_rate () const |
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number of frames elapsed in that time interval. More... | |
double | get_history () const |
Returns the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added. More... | |
const PStatFrameData & | get_latest_frame () const |
Returns the FrameData associated with the most recent frame. More... | |
int | get_latest_frame_number () const |
Returns the frame number of the most recent frame stored in the data. More... | |
double | get_latest_time () const |
Returns the timestamp (in seconds elapsed since connection) of the latest available frame. More... | |
int | get_oldest_frame_number () const |
Returns the frame number of the oldest frame still stored in the data. More... | |
double | get_oldest_time () const |
Returns the timestamp (in seconds elapsed since connection) of the oldest available frame. More... | |
bool | has_frame (int frame_number) const |
Returns true if we have received data for the indicated frame number from the client and we still have it stored, or false otherwise. More... | |
bool | is_empty () const |
Returns true if the structure contains no frames, false otherwise. More... | |
void | record_new_frame (int frame_number, PStatFrameData *frame_data) |
Makes room for and stores a new frame's worth of data. More... | |
void | set_history (double time) |
Sets the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added. More... | |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Additional Inherited Members | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
A collection of FrameData structures for recently-received frames within a particular thread.
This holds the raw data as reported by the client, and it automatically handles frames received out-of-order or skipped. You can ask for a particular frame by frame number or time and receive the data for the nearest frame.
Definition at line 38 of file pStatThreadData.h.
|
inline |
Returns a pointer to the ClientData structure associated with this data.
Definition at line 23 of file pStatThreadData.I.
Referenced by PStatView::unconstrain().
bool PStatThreadData::get_elapsed_frames | ( | int & | then_i, |
int & | now_i | ||
) | const |
Computes the oldest frame number not older than pstats_average_time seconds, and the newest frame number.
Handy for computing average frame rate over a time. Returns true if there is any data in that range, false otherwise.
Definition at line 239 of file pStatThreadData.cxx.
References get_frame_rate().
Referenced by get_latest_frame(), and PStatStripChart::is_title_unknown().
const PStatFrameData & PStatThreadData::get_frame | ( | int | frame_number | ) | const |
Returns a FrameData structure associated with the indicated frame number.
If the frame data has not yet been received from the client, returns the newest frame older than the requested frame.
Definition at line 107 of file pStatThreadData.cxx.
References get_latest_time(), and PStatFrameData::get_start().
Referenced by has_frame(), PStatStripChart::is_title_unknown(), TextMonitor::new_data(), PStatPianoRoll::update(), and PStatStripChart::update().
const PStatFrameData & PStatThreadData::get_frame_at_time | ( | double | time | ) | const |
Returns the FrameData structure associated with the latest frame not later than the indicated time.
Definition at line 168 of file pStatThreadData.cxx.
References get_frame_number_at_time().
Referenced by get_oldest_time().
int PStatThreadData::get_frame_number_at_time | ( | double | time, |
int | hint = -1 |
||
) | const |
Returns the frame number of the latest frame not later than the indicated time.
If the hint is nonnegative, it represents a frame number that we believe the correct answer to be near, which may speed the search for the frame.
Definition at line 183 of file pStatThreadData.cxx.
References get_latest_frame(), and PStatFrameData::get_start().
Referenced by PStatStripChart::get_collector_under_pixel(), get_frame_at_time(), and PStatStripChart::set_auto_vertical_scale().
double PStatThreadData::get_frame_rate | ( | ) | const |
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number of frames elapsed in that time interval.
Definition at line 257 of file pStatThreadData.cxx.
References set_history().
Referenced by get_elapsed_frames(), WinStatsMonitor::idle(), GtkStatsMonitor::idle(), and TextMonitor::new_data().
double PStatThreadData::get_history | ( | ) | const |
Returns the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.
This affects how old the oldest frame that may be queried is.
Definition at line 292 of file pStatThreadData.cxx.
References record_new_frame().
Referenced by set_history().
const PStatFrameData & PStatThreadData::get_latest_frame | ( | ) | const |
Returns the FrameData associated with the most recent frame.
Definition at line 224 of file pStatThreadData.cxx.
References get_elapsed_frames().
Referenced by get_frame_number_at_time().
int PStatThreadData::get_latest_frame_number | ( | ) | const |
Returns the frame number of the most recent frame stored in the data.
Definition at line 66 of file pStatThreadData.cxx.
References get_oldest_frame_number().
Referenced by is_empty(), PStatStripChart::is_title_unknown(), TextMonitor::new_data(), PStatPianoRoll::update(), and PStatStripChart::update().
double PStatThreadData::get_latest_time | ( | ) | const |
Returns the timestamp (in seconds elapsed since connection) of the latest available frame.
Definition at line 144 of file pStatThreadData.cxx.
References get_oldest_time().
Referenced by get_frame().
int PStatThreadData::get_oldest_frame_number | ( | ) | const |
Returns the frame number of the oldest frame still stored in the data.
Definition at line 78 of file pStatThreadData.cxx.
References has_frame().
Referenced by get_latest_frame_number().
double PStatThreadData::get_oldest_time | ( | ) | const |
Returns the timestamp (in seconds elapsed since connection) of the oldest available frame.
Definition at line 156 of file pStatThreadData.cxx.
References get_frame_at_time().
Referenced by get_latest_time(), and PStatStripChart::is_title_unknown().
bool PStatThreadData::has_frame | ( | int | frame_number | ) | const |
Returns true if we have received data for the indicated frame number from the client and we still have it stored, or false otherwise.
Definition at line 91 of file pStatThreadData.cxx.
References get_frame().
Referenced by get_oldest_frame_number(), and PStatStripChart::set_auto_vertical_scale().
bool PStatThreadData::is_empty | ( | ) | const |
Returns true if the structure contains no frames, false otherwise.
Definition at line 55 of file pStatThreadData.cxx.
References get_latest_frame_number().
Referenced by PStatStripChart::is_title_unknown(), PStatPianoRoll::update(), and PStatStripChart::update().
void PStatThreadData::record_new_frame | ( | int | frame_number, |
PStatFrameData * | frame_data | ||
) |
Makes room for and stores a new frame's worth of data.
Calling this function may cause old frame data to be discarded to make room, according to the amount of time set up via set_history().
The pointer will become owned by the PStatThreadData object and will be freed on destruction.
Definition at line 309 of file pStatThreadData.cxx.
References PStatFrameData::get_start(), and PStatFrameData::is_empty().
Referenced by get_history().
void PStatThreadData::set_history | ( | double | time | ) |
Sets the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.
This affects how old the oldest frame that may be queried is.
Definition at line 279 of file pStatThreadData.cxx.
References get_history().
Referenced by get_frame_rate().