Panda3D
Loading...
Searching...
No Matches
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.
 
void close ()
 Closes the client connection if it is open.
 
void define_thread (int thread_index, const std::string &name=std::string())
 Adds a new thread definition to the dataset.
 
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.
 
const PStatCollectorDefget_collector_def (int index) const
 Returns the nth collector definition.
 
std::string get_collector_fullname (int index) const
 Returns the "full name" of the indicated collector.
 
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).
 
std::string get_collector_name (int index) const
 Returns the name of the indicated collector.
 
int get_num_collectors () const
 Returns the total number of collectors the Data knows about.
 
int get_num_threads () const
 Returns the total number of threads the Data knows about.
 
int get_num_toplevel_collectors () const
 Returns the total number of collectors that are toplevel collectors.
 
const PStatThreadDataget_thread_data (int index) const
 Returns the data associated with the indicated thread.
 
std::string get_thread_name (int index) const
 Returns the name of the indicated thread.
 
int get_toplevel_collector (int index) const
 Returns the collector index of the nth toplevel collector.
 
bool has_collector (int index) const
 Returns true if the indicated collector has been defined by the client already, false otherwise.
 
bool has_thread (int index) const
 Returns true if the indicated thread has been defined by the client already, false otherwise.
 
bool is_alive () const
 Returns true if the data is actively getting filled by a connected client, or false if the client has terminated.
 
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).
 
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).
 
- 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.
 
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.
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
 
void ref () const
 Explicitly increments the reference count.
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero.
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
 
virtual bool unref () const
 Explicitly decrements the reference count.
 
bool unref_if_one () const
 Atomically decreases the reference count of this object if it is one.
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object.
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object.
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 

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.
 

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.

Constructor & Destructor Documentation

◆ PStatClientData()

PStatClientData::PStatClientData ( PStatReader * reader)

Definition at line 28 of file pStatClientData.cxx.

◆ ~PStatClientData()

PStatClientData::~PStatClientData ( )

Definition at line 38 of file pStatClientData.cxx.

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

References BitArray::get_bit(), BitArray::get_num_bits(), and set_collector_has_level().

◆ close()

void PStatClientData::close ( )

Closes the client connection if it is open.

Definition at line 58 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 289 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 238 of file pStatClientData.cxx.

References get_child_distance(), get_collector_def(), and has_collector().

Referenced by get_child_distance().

◆ 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 114 of file pStatClientData.cxx.

References get_collector_fullname(), and has_collector().

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

◆ 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 164 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), and TextMonitor::new_data().

◆ get_collector_name()

string PStatClientData::get_collector_name ( int index) const

Returns the name of the indicated collector.

Definition at line 100 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 70 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 193 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 174 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), and TextMonitor::new_data().

◆ 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 224 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 212 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 184 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), and TextMonitor::new_data().

◆ 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 80 of file pStatClientData.cxx.

Referenced by WinStatsStripChart::clicked_label(), WinStatsChartMenu::do_update(), get_child_distance(), get_collector_def(), get_collector_fullname(), get_collector_name(), PStatStripChart::get_title_text(), TextMonitor::new_data(), 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 203 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 50 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 316 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 134 of file pStatClientData.cxx.

References set_collector_has_level().

Referenced by add_collector(), and set_collector_has_level().

Friends And Related Symbol Documentation

◆ PStatReader

friend class PStatReader
friend

Definition at line 97 of file pStatClientData.h.


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