Panda3D
Loading...
Searching...
No Matches
Public Member Functions | List of all members
PStatCollector Class Reference

A lightweight class that represents a single element that may be timed and/or counted via stats. More...

#include "pStatCollector.h"

Public Member Functions

 PStatCollector ()
 Creates an invalid PStatCollector.
 
 PStatCollector (const PStatCollector &parent, const std::string &name)
 This bogus version of the function is only defined if DO_PSTATS is not defined, meaning all these functions should compile to nothing.
 
 PStatCollector (const std::string &name, PStatClient *client=nullptr)
 This bogus version of the function is only defined if DO_PSTATS is not defined, meaning all these functions should compile to nothing.
 
void add_level (const PStatThread &, double)
 
void add_level (double)
 
void add_level_now (double)
 
void clear_level ()
 
void clear_level (const PStatThread &)
 
void flush_level ()
 
int get_index () const
 
double get_level ()
 
double get_level (const PStatThread &)
 
bool is_active ()
 
bool is_active (const PStatThread &)
 
bool is_started ()
 
void set_level (const PStatThread &, double)
 
void set_level (double)
 
void start ()
 
void start (const PStatThread &)
 
void start (const PStatThread &, double)
 
void stop ()
 
void stop (const PStatThread &)
 
void stop (const PStatThread &, double)
 
void sub_level (const PStatThread &, double)
 
void sub_level (double)
 
void sub_level_now (double)
 

Detailed Description

A lightweight class that represents a single element that may be timed and/or counted via stats.

Collectors can be used to measure two different kinds of values: elapsed time, and "other".

To measure elapsed time, call start() and stop() as appropriate to bracket the section of code you want to time (or use a PStatTimer to do this automatically).

To measure anything else, call set_level() and/or add_level() to set the "level" value associated with this collector. The meaning of the value set for the "level" is entirely up to the user; it may represent the number of triangles rendered or the kilobytes of texture memory consumed, for instance. The level set will remain fixed across multiple frames until it is reset via another set_level() or adjusted via a call to add_level(). It may also be completely removed via clear_level().

Definition at line 43 of file pStatCollector.h.

Constructor & Destructor Documentation

◆ PStatCollector() [1/3]

PStatCollector::PStatCollector ( )
inline

Creates an invalid PStatCollector.

Any attempt to use this collector will crash messily.

You can reassign it to a different, valid one later.

Definition at line 473 of file pStatCollector.I.

◆ PStatCollector() [2/3]

PStatCollector::PStatCollector ( const std::string & name,
PStatClient * client = nullptr )
inline

This bogus version of the function is only defined if DO_PSTATS is not defined, meaning all these functions should compile to nothing.

Definition at line 482 of file pStatCollector.I.

◆ PStatCollector() [3/3]

PStatCollector::PStatCollector ( const PStatCollector & parent,
const std::string & name )
inline

This bogus version of the function is only defined if DO_PSTATS is not defined, meaning all these functions should compile to nothing.

Definition at line 497 of file pStatCollector.I.

Member Function Documentation

◆ add_level() [1/2]

void PStatCollector::add_level ( const PStatThread & ,
double  )
inline

Definition at line 138 of file pStatCollector.h.

◆ add_level() [2/2]

void PStatCollector::add_level ( double )
inline

Definition at line 123 of file pStatCollector.h.

◆ add_level_now()

void PStatCollector::add_level_now ( double )
inline

Definition at line 125 of file pStatCollector.h.

◆ clear_level() [1/2]

void PStatCollector::clear_level ( )
inline

Definition at line 121 of file pStatCollector.h.

◆ clear_level() [2/2]

void PStatCollector::clear_level ( const PStatThread & )
inline

Definition at line 136 of file pStatCollector.h.

◆ flush_level()

void PStatCollector::flush_level ( )
inline

Definition at line 127 of file pStatCollector.h.

◆ get_index()

int PStatCollector::get_index ( ) const
inline

Definition at line 142 of file pStatCollector.h.

◆ get_level() [1/2]

double PStatCollector::get_level ( )
inline

Definition at line 128 of file pStatCollector.h.

◆ get_level() [2/2]

double PStatCollector::get_level ( const PStatThread & )
inline

Definition at line 140 of file pStatCollector.h.

◆ is_active() [1/2]

bool PStatCollector::is_active ( )
inline

Definition at line 116 of file pStatCollector.h.

◆ is_active() [2/2]

bool PStatCollector::is_active ( const PStatThread & )
inline

Definition at line 130 of file pStatCollector.h.

◆ is_started()

bool PStatCollector::is_started ( )
inline

Definition at line 117 of file pStatCollector.h.

◆ set_level() [1/2]

void PStatCollector::set_level ( const PStatThread & ,
double  )
inline

Definition at line 137 of file pStatCollector.h.

◆ set_level() [2/2]

void PStatCollector::set_level ( double )
inline

Definition at line 122 of file pStatCollector.h.

◆ start() [1/3]

void PStatCollector::start ( )
inline

Definition at line 118 of file pStatCollector.h.

◆ start() [2/3]

void PStatCollector::start ( const PStatThread & )
inline

Definition at line 131 of file pStatCollector.h.

◆ start() [3/3]

void PStatCollector::start ( const PStatThread & ,
double  )
inline

Definition at line 132 of file pStatCollector.h.

◆ stop() [1/3]

void PStatCollector::stop ( )
inline

Definition at line 119 of file pStatCollector.h.

◆ stop() [2/3]

void PStatCollector::stop ( const PStatThread & )
inline

Definition at line 133 of file pStatCollector.h.

◆ stop() [3/3]

void PStatCollector::stop ( const PStatThread & ,
double  )
inline

Definition at line 134 of file pStatCollector.h.

◆ sub_level() [1/2]

void PStatCollector::sub_level ( const PStatThread & ,
double  )
inline

Definition at line 139 of file pStatCollector.h.

◆ sub_level() [2/2]

void PStatCollector::sub_level ( double )
inline

Definition at line 124 of file pStatCollector.h.

◆ sub_level_now()

void PStatCollector::sub_level_now ( double )
inline

Definition at line 126 of file pStatCollector.h.


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