Panda3D
Public Member Functions
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

List of all members.

Public Member Functions

 PStatThreadData (const PStatClientData *client_data)
const PStatClientDataget_client_data () const
 Returns a pointer to the ClientData structure associated with this data.
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.
const PStatFrameDataget_frame (int frame_number) const
 Returns a FrameData structure associated with the indicated frame number.
const PStatFrameDataget_frame_at_time (double time) const
 Returns the FrameData structure associated with the latest frame not later than the indicated time.
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.
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.
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.
const PStatFrameDataget_latest_frame () const
 Returns the FrameData associated with the most recent frame.
int get_latest_frame_number () const
 Returns the frame number of the most recent frame stored in the data.
double get_latest_time () const
 Returns the timestamp (in seconds elapsed since connection) of the latest available frame.
int get_oldest_frame_number () const
 Returns the frame number of the oldest frame still stored in the data.
double get_oldest_time () const
 Returns the timestamp (in seconds elapsed since connection) of the oldest available frame.
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.
bool is_empty () const
 Returns true if the structure contains no frames, false otherwise.
void record_new_frame (int frame_number, PStatFrameData *frame_data)
 Makes room for and stores a new frame's worth of data.
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.

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


Member Function Documentation

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

Definition at line 23 of file pStatThreadData.I.

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.

Referenced by PStatStripChart::get_average_net_value(), and get_frame_rate().

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 PStatFrameData::get_start().

Referenced by PStatStripChart::compute_average_pixel_data(), PStatStripChart::get_average_net_value(), get_frame_at_time(), PStatStripChart::get_frame_data(), 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(), and 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 183 of file pStatThreadData.cxx.

References PStatFrameData::get_start().

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

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 get_elapsed_frames().

Referenced by 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.

Returns the FrameData associated with the most recent frame.

Definition at line 224 of file pStatThreadData.cxx.

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

Definition at line 66 of file pStatThreadData.cxx.

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

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

Definition at line 144 of file pStatThreadData.cxx.

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

Definition at line 78 of file pStatThreadData.cxx.

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

Definition at line 156 of file pStatThreadData.cxx.

Referenced by PStatStripChart::compute_average_pixel_data().

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.

Referenced by 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.

Referenced by PStatStripChart::compute_average_pixel_data(), 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().

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.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations