Panda3D
Public Member Functions | List of all members
PStatThreadData Class Reference

A collection of FrameData structures for recently-received frames within a particular thread. More...

#include "pStatThreadData.h"

Inheritance diagram for PStatThreadData:
ReferenceCount MemoryBase

Public Member Functions

 PStatThreadData (const PStatClientData *client_data)
 
const PStatClientDataget_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 PStatFrameDataget_frame (int frame_number) const
 Returns a FrameData structure associated with the indicated frame number. More...
 
const PStatFrameDataget_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 PStatFrameDataget_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...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_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 ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. 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...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

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 34 of file pStatThreadData.h.

Member Function Documentation

◆ get_client_data()

const PStatClientData * PStatThreadData::get_client_data ( ) const
inline

Returns a pointer to the ClientData structure associated with this data.

Definition at line 18 of file pStatThreadData.I.

◆ get_elapsed_frames()

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 203 of file pStatThreadData.cxx.

Referenced by get_frame_rate().

◆ get_frame()

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 87 of file pStatThreadData.cxx.

Referenced by get_frame_at_time(), TextMonitor::new_data(), PStatPianoRoll::update(), and PStatStripChart::update().

◆ get_frame_at_time()

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 142 of file pStatThreadData.cxx.

References get_frame(), and get_frame_number_at_time().

◆ get_frame_number_at_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 154 of file pStatThreadData.cxx.

Referenced by PStatStripChart::get_collector_under_pixel(), get_frame_at_time(), and PStatStripChart::set_auto_vertical_scale().

◆ get_frame_rate()

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 218 of file pStatThreadData.cxx.

References get_elapsed_frames().

Referenced by WinStatsMonitor::idle(), and TextMonitor::new_data().

◆ get_history()

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 247 of file pStatThreadData.cxx.

◆ get_latest_frame()

const PStatFrameData & PStatThreadData::get_latest_frame ( ) const

Returns the FrameData associated with the most recent frame.

Definition at line 191 of file pStatThreadData.cxx.

◆ get_latest_frame_number()

int PStatThreadData::get_latest_frame_number ( ) const

Returns the frame number of the most recent frame stored in the data.

Definition at line 55 of file pStatThreadData.cxx.

Referenced by TextMonitor::new_data(), PStatPianoRoll::update(), and PStatStripChart::update().

◆ get_latest_time()

double PStatThreadData::get_latest_time ( ) const

Returns the timestamp (in seconds elapsed since connection) of the latest available frame.

Definition at line 122 of file pStatThreadData.cxx.

◆ get_oldest_frame_number()

int PStatThreadData::get_oldest_frame_number ( ) const

Returns the frame number of the oldest frame still stored in the data.

Definition at line 64 of file pStatThreadData.cxx.

◆ get_oldest_time()

double PStatThreadData::get_oldest_time ( ) const

Returns the timestamp (in seconds elapsed since connection) of the oldest available frame.

Definition at line 132 of file pStatThreadData.cxx.

◆ has_frame()

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 74 of file pStatThreadData.cxx.

Referenced by PStatStripChart::set_auto_vertical_scale().

◆ is_empty()

bool PStatThreadData::is_empty ( ) const

Returns true if the structure contains no frames, false otherwise.

Definition at line 47 of file pStatThreadData.cxx.

Referenced by PStatPianoRoll::update(), and PStatStripChart::update().

◆ record_new_frame()

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 261 of file pStatThreadData.cxx.

◆ set_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 237 of file pStatThreadData.cxx.


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