Panda3D
Classes | Public Member Functions | Friends | List of all members
PStatClientData Class Reference

The data associated with a particular client, but not with any one particular frame or thread: the list of collectors and threads, for instance. More...

#include "pStatClientData.h"

Inheritance diagram for PStatClientData:
PStatClientVersion ReferenceCount MemoryBase

Public Member Functions

 PStatClientData (PStatReader *reader)
 
void add_collector (PStatCollectorDef *def)
 Adds a new collector definition to the dataset. More...
 
void close ()
 Closes the client connection if it is open. More...
 
void define_thread (int thread_index, const std::string &name=std::string())
 Adds a new thread definition to the dataset. More...
 
int get_child_distance (int parent, int child) const
 Returns the number of Collectors between the indicated parent and the child Collector in the relationship graph. More...
 
const PStatCollectorDefget_collector_def (int index) const
 Returns the nth collector definition. More...
 
std::string get_collector_fullname (int index) const
 Returns the "full name" of the indicated collector. More...
 
bool get_collector_has_level (int index, int thread_index) const
 Returns whether the given collector has level data (and consequently, whether it should appear on the Levels menu). More...
 
std::string get_collector_name (int index) const
 Returns the name of the indicated collector. More...
 
int get_num_collectors () const
 Returns the total number of collectors the Data knows about. More...
 
int get_num_threads () const
 Returns the total number of threads the Data knows about. More...
 
int get_num_toplevel_collectors () const
 Returns the total number of collectors that are toplevel collectors. More...
 
const PStatThreadDataget_thread_data (int index) const
 Returns the data associated with the indicated thread. More...
 
std::string get_thread_name (int index) const
 Returns the name of the indicated thread. More...
 
int get_toplevel_collector (int index) const
 Returns the collector index of the nth toplevel collector. More...
 
bool has_collector (int index) const
 Returns true if the indicated collector has been defined by the client already, false otherwise. More...
 
bool has_thread (int index) const
 Returns true if the indicated thread has been defined by the client already, false otherwise. More...
 
bool is_alive () const
 Returns true if the data is actively getting filled by a connected client, or false if the client has terminated. More...
 
void record_new_frame (int thread_index, int frame_number, PStatFrameData *frame_data)
 Makes room for and stores a new frame's worth of data associated with some particular thread (which may or may not have already been defined). More...
 
bool set_collector_has_level (int index, int thread_index, bool flag)
 Indicates whether the given collector has level data (and consequently, whether it should appear on the Levels menu). More...
 
- Public Member Functions inherited from PStatClientVersion
int get_major_version () const
 
int get_minor_version () const
 
bool is_at_least (int major_version, int minor_version) const
 Returns true if the client version is at least the indicated major/minor version number, false otherwise. More...
 
void set_version (int major_version, int minor_version)
 
- 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...
 

Friends

class PStatReader
 

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

The data associated with a particular client, but not with any one particular frame or thread: the list of collectors and threads, for instance.

Definition at line 36 of file pStatClientData.h.

Member Function Documentation

◆ add_collector()

void PStatClientData::add_collector ( PStatCollectorDef def)

Adds a new collector definition to the dataset.

Presumably this is information just arrived from the client.

The pointer will become owned by the PStatClientData object and will be freed on destruction.

Definition at line 262 of file pStatClientData.cxx.

◆ close()

void PStatClientData::close ( )

Closes the client connection if it is open.

Definition at line 59 of file pStatClientData.cxx.

References PStatReader::close().

◆ define_thread()

void PStatClientData::define_thread ( int  thread_index,
const std::string &  name = std::string() 
)

Adds a new thread definition to the dataset.

Presumably this is information just arrived from the client.

Definition at line 290 of file pStatClientData.cxx.

Referenced by record_new_frame().

◆ get_child_distance()

int PStatClientData::get_child_distance ( int  parent,
int  child 
) const

Returns the number of Collectors between the indicated parent and the child Collector in the relationship graph.

If child is the same as parent, returns zero. If child is an immediate child of parent, returns 1. If child is a grandchild of parent, returns 2, and so on. If child is not a descendant of parent at all, returns -1.

Definition at line 239 of file pStatClientData.cxx.

References get_collector_def(), and has_collector().

◆ get_collector_def()

const PStatCollectorDef & PStatClientData::get_collector_def ( int  index) const

◆ get_collector_fullname()

string PStatClientData::get_collector_fullname ( int  index) const

Returns the "full name" of the indicated collector.

This will be the concatenation of all of the collector's parents' names (except Frame) and the collector's own name.

Definition at line 115 of file pStatClientData.cxx.

References has_collector().

Referenced by PStatStripChart::get_title_text().

◆ get_collector_has_level()

bool PStatClientData::get_collector_has_level ( int  index,
int  thread_index 
) const

Returns whether the given collector has level data (and consequently, whether it should appear on the Levels menu).

Definition at line 165 of file pStatClientData.cxx.

◆ get_collector_name()

string PStatClientData::get_collector_name ( int  index) const

Returns the name of the indicated collector.

Definition at line 101 of file pStatClientData.cxx.

References has_collector().

◆ get_num_collectors()

int PStatClientData::get_num_collectors ( ) const

Returns the total number of collectors the Data knows about.

Definition at line 71 of file pStatClientData.cxx.

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

◆ get_num_threads()

int PStatClientData::get_num_threads ( ) const

Returns the total number of threads the Data knows about.

Definition at line 194 of file pStatClientData.cxx.

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

◆ get_num_toplevel_collectors()

int PStatClientData::get_num_toplevel_collectors ( ) const

Returns the total number of collectors that are toplevel collectors.

These are the collectors that are the children of "Frame", which is collector 0.

Definition at line 175 of file pStatClientData.cxx.

◆ get_thread_data()

const PStatThreadData * PStatClientData::get_thread_data ( int  index) const

Returns the data associated with the indicated thread.

This will create a thread definition if it does not already exist.

Definition at line 225 of file pStatClientData.cxx.

Referenced by WinStatsMonitor::idle(), and PStatPianoRoll::update().

◆ get_thread_name()

string PStatClientData::get_thread_name ( int  index) const

Returns the name of the indicated thread.

Definition at line 213 of file pStatClientData.cxx.

References has_thread().

Referenced by WinStatsChartMenu::add_to_menu_bar(), PStatStripChart::get_title_text(), and TextMonitor::new_data().

◆ get_toplevel_collector()

int PStatClientData::get_toplevel_collector ( int  n) const

Returns the collector index of the nth toplevel collector.

Use this function to iterate through the n toplevel collectors indicated by get_num_toplevel_collectors().

Definition at line 185 of file pStatClientData.cxx.

◆ has_collector()

bool PStatClientData::has_collector ( int  index) const

Returns true if the indicated collector has been defined by the client already, false otherwise.

It is possible for the client to start streaming data before all of the collectors have been defined.

Definition at line 81 of file pStatClientData.cxx.

Referenced by WinStatsStripChart::clicked_label(), get_child_distance(), get_collector_def(), get_collector_fullname(), get_collector_name(), PStatStripChart::get_title_text(), and PStatStripChart::set_default_vertical_scale().

◆ has_thread()

bool PStatClientData::has_thread ( int  index) const

Returns true if the indicated thread has been defined by the client already, false otherwise.

It is possible for the client to start streaming data before all of the threads have been defined.

Definition at line 204 of file pStatClientData.cxx.

Referenced by get_thread_name(), and PStatStripChart::get_title_text().

◆ is_alive()

bool PStatClientData::is_alive ( ) const

Returns true if the data is actively getting filled by a connected client, or false if the client has terminated.

Definition at line 51 of file pStatClientData.cxx.

◆ record_new_frame()

void PStatClientData::record_new_frame ( int  thread_index,
int  frame_number,
PStatFrameData frame_data 
)

Makes room for and stores a new frame's worth of data associated with some particular thread (which may or may not have already been defined).

The pointer will become owned by the PStatThreadData object and will be freed on destruction.

Definition at line 317 of file pStatClientData.cxx.

References define_thread().

◆ set_collector_has_level()

bool PStatClientData::set_collector_has_level ( int  index,
int  thread_index,
bool  flag 
)

Indicates whether the given collector has level data (and consequently, whether it should appear on the Levels menu).

The return value is true if anything changed, false otherwise.

Definition at line 135 of file pStatClientData.cxx.


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