# PStatCollector

from pandac.PandaModules import PStatCollector

Class : PStatCollector
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().

## Inheritance:

PStatCollector:

## Methods of PStatCollector:

addLevel
addLevelNow
addThreadLevel
clearLevel
clearThreadLevel
flushLevel
getFullname
getIndex
getLevel
getName
getThreadLevel
isActive
isStarted
isValid
operator =
output
setLevel
setThreadLevel
start
stop
subLevel
subLevelNow
subThreadLevel

addLevel void PStatCollector::add_level(double increment); Description: Adds the indicated increment (which may be negative) to the level setting associated with this collector for the main thread. If the collector did not already have a level setting for the main thread, it is initialized to 0. As an optimization, the data is not immediately set to the PStatClient. It will be sent the next time flush_level() is called. Description: Adds the indicated increment (which may be negative) to the level setting associated with this collector for the indicated thread. If the collector did not already have a level setting for this thread, it is initialized to 0.

addLevelNow void PStatCollector::add_level_now(double increment); Description: Calls add_level() and immediately calls flush_level().

addThreadLevel void PStatCollector::add_thread_level(double increment); Description: Adds the indicated increment (which may be negative) to the level setting associated with this collector for the current thread. If the collector did not already have a level setting for the current thread, it is initialized to 0.

clearLevel void PStatCollector::clear_level(void); Description: Removes the level setting associated with this collector for the main thread. The collector will no longer show up on any level graphs in the main thread. This implicitly calls flush_level(). Description: Removes the level setting associated with this collector for the indicated thread. The collector will no longer show up on any level graphs in this thread.

clearThreadLevel void PStatCollector::clear_thread_level(void); Description: Removes the level setting associated with this collector for the current thread. The collector will no longer show up on any level graphs in the current thread.

flushLevel void PStatCollector::flush_level(void); Description: Updates the PStatClient with the recent results from add_level() and sub_level().

getFullname string PStatCollector::get_fullname(void) const; Description: Returns the full name of this collector. This includes the names of all the collector's parents, concatenated together with colons.

getIndex int PStatCollector::get_index(void) const; Description: Returns the index number of this particular collector within the PStatClient.

getLevel double PStatCollector::get_level(void); Description: Returns the current level value of the given collector in the main thread. This implicitly calls flush_level(). Description: Returns the current level value of the given collector.

getName string PStatCollector::get_name(void) const; Description: Returns the local name of this collector. This is the rightmost part of the fullname, after the rightmost colon.

getThreadLevel double PStatCollector::get_thread_level(void); Description: Returns the current level value of the given collector in the current thread.

isActive bool PStatCollector::is_active(void); Description: Returns true if this particular collector is active on the default thread, and we are currently transmitting PStats data. Description: Returns true if this particular collector is active on the indicated thread, and we are currently transmitting PStats data.

isStarted bool PStatCollector::is_started(void); Description: Returns true if this particular collector has been started on the default thread, or false otherwise. Description: Returns true if this particular collector has been started on the indicated thread, or false otherwise.

isValid bool PStatCollector::is_valid(void) const; Description: Returns true if collector is valid and may be used, or false if it was constructed with the default constructor (in which case any attempt to use it will crash).

operator = void PStatCollector::operator =(PStatCollector const &copy); Description:

output void PStatCollector::output(ostream &out) const; Description:

setLevel void PStatCollector::set_level(double level); Description: Sets the level setting associated with this collector for the main thread to the indicated value. This implicitly calls flush_level(). Description: Sets the level setting associated with this collector for the indicated thread to the indicated value.

setThreadLevel void PStatCollector::set_thread_level(double level); Description: Sets the level setting associated with this collector for the current thread to the indicated value.

start void PStatCollector::start(void); Description: Starts this particular timer ticking. This should be called before the code you want to measure. Description: Starts this timer ticking within a particular thread. Description: Marks that the timer should have been started as of the indicated time. This must be a time based on the PStatClient's clock (see PStatClient::get_clock()), and care should be taken that all such calls exhibit a monotonically increasing series of time values.

stop void PStatCollector::stop(void); Description: Stops this timer. This should be called after the code you want to measure. Description: Stops this timer within a particular thread. Description: Marks that the timer should have been stopped as of the indicated time. This must be a time based on the PStatClient's clock (see PStatClient::get_clock()), and care should be taken that all such calls exhibit a monotonically increasing series of time values.

subLevel void PStatCollector::sub_level(double decrement); Description: Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the main thread. If the collector did not already have a level setting for the main thread, it is initialized to 0. As an optimization, the data is not immediately set to the PStatClient. It will be sent the next time flush_level() is called. Description: Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the indicated thread. If the collector did not already have a level setting for this thread, it is initialized to 0.

subLevelNow void PStatCollector::sub_level_now(double decrement); Description: Calls sub_level() and immediately calls flush_level().

subThreadLevel void PStatCollector::sub_thread_level(double decrement); Description: Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the current thread. If the collector did not already have a level setting for the current thread, it is initialized to 0.