Panda3D
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. More...
 
 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. More...
 
 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. More...
 
void add_level (double)
 
void add_level (const PStatThread &, 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 (double)
 
void set_level (const PStatThread &, 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 (double)
 
void sub_level (const PStatThread &, 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 474 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 483 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 498 of file pStatCollector.I.


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