PStatCollector

from panda3d.core import PStatCollector
class PStatCollector

Bases: DTOOL_SUPER_BASE

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 diagram

Inheritance diagram of PStatCollector

__init__(*args, **kwargs)
addLevel()

C++ Interface: add_level(const PStatCollector self, double increment) add_level(const PStatCollector self, const PStatThread thread, double increment)

/**
  • 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

  • As an optimization, the data is not immediately set to the PStatClient. It

  • will be sent the next time flush_level() is called.

*/

/**
  • 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

*/

addLevelNow()

C++ Interface: add_level_now(const PStatCollector self, double increment)

/**
  • Calls add_level() and immediately calls flush_level().

*/

addThreadLevel()

C++ Interface: add_thread_level(const PStatCollector self, double increment)

/**
  • 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.

*/

add_level()

C++ Interface: add_level(const PStatCollector self, double increment) add_level(const PStatCollector self, const PStatThread thread, double increment)

/**
  • 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

  • As an optimization, the data is not immediately set to the PStatClient. It

  • will be sent the next time flush_level() is called.

*/

/**
  • 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

*/

add_level_now()

C++ Interface: add_level_now(const PStatCollector self, double increment)

/**
  • Calls add_level() and immediately calls flush_level().

*/

add_thread_level()

C++ Interface: add_thread_level(const PStatCollector self, double increment)

/**
  • 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.

*/

assign()

C++ Interface: assign(const PStatCollector self, const PStatCollector copy)

clearLevel()

C++ Interface: clear_level(const PStatCollector self) clear_level(const PStatCollector self, const PStatThread thread)

/**
  • 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().

*/

/**
  • 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()

C++ Interface: clear_thread_level(const PStatCollector self)

/**
  • 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.

*/

clear_level()

C++ Interface: clear_level(const PStatCollector self) clear_level(const PStatCollector self, const PStatThread thread)

/**
  • 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().

*/

/**
  • 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.

*/

clear_thread_level()

C++ Interface: clear_thread_level(const PStatCollector self)

/**
  • 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()

C++ Interface: flush_level(const PStatCollector self)

/**
  • Updates the PStatClient with the recent results from add_level() and

  • sub_level().

*/

flush_level()

C++ Interface: flush_level(const PStatCollector self)

/**
  • Updates the PStatClient with the recent results from add_level() and

  • sub_level().

*/

getFullname()

C++ Interface: get_fullname(PStatCollector self)

/**
  • Returns the full name of this collector. This includes the names of all

  • the collector’s parents, concatenated together with colons.

*/

getIndex()

C++ Interface: get_index(PStatCollector self)

/**
  • Returns the index number of this particular collector within the

  • PStatClient.

*/

getLevel()

C++ Interface: get_level(const PStatCollector self) get_level(const PStatCollector self, const PStatThread thread)

/**
  • Returns the current level value of the given collector in the main thread.

  • This implicitly calls flush_level().

*/

/**
  • Returns the current level value of the given collector.

*/

getName()

C++ Interface: get_name(PStatCollector self)

/**
  • Returns the local name of this collector. This is the rightmost part of

  • the fullname, after the rightmost colon.

*/

getThreadLevel()

C++ Interface: get_thread_level(const PStatCollector self)

/**
  • Returns the current level value of the given collector in the current

  • thread.

*/

get_fullname()

C++ Interface: get_fullname(PStatCollector self)

/**
  • Returns the full name of this collector. This includes the names of all

  • the collector’s parents, concatenated together with colons.

*/

get_index()

C++ Interface: get_index(PStatCollector self)

/**
  • Returns the index number of this particular collector within the

  • PStatClient.

*/

get_level()

C++ Interface: get_level(const PStatCollector self) get_level(const PStatCollector self, const PStatThread thread)

/**
  • Returns the current level value of the given collector in the main thread.

  • This implicitly calls flush_level().

*/

/**
  • Returns the current level value of the given collector.

*/

get_name()

C++ Interface: get_name(PStatCollector self)

/**
  • Returns the local name of this collector. This is the rightmost part of

  • the fullname, after the rightmost colon.

*/

get_thread_level()

C++ Interface: get_thread_level(const PStatCollector self)

/**
  • Returns the current level value of the given collector in the current

  • thread.

*/

isActive()

C++ Interface: is_active(const PStatCollector self) is_active(const PStatCollector self, const PStatThread thread)

/**
  • Returns true if this particular collector is active on the default thread,

  • and we are currently transmitting PStats data.

*/

/**
  • Returns true if this particular collector is active on the indicated

  • thread, and we are currently transmitting PStats data.

*/

isStarted()

C++ Interface: is_started(const PStatCollector self) is_started(const PStatCollector self, const PStatThread thread)

/**
  • Returns true if this particular collector has been started on the default

  • thread, or false otherwise.

*/

/**
  • Returns true if this particular collector has been started on the indicated

  • thread, or false otherwise.

*/

isValid()

C++ Interface: is_valid(PStatCollector self)

/**
  • 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).

*/

is_active()

C++ Interface: is_active(const PStatCollector self) is_active(const PStatCollector self, const PStatThread thread)

/**
  • Returns true if this particular collector is active on the default thread,

  • and we are currently transmitting PStats data.

*/

/**
  • Returns true if this particular collector is active on the indicated

  • thread, and we are currently transmitting PStats data.

*/

is_started()

C++ Interface: is_started(const PStatCollector self) is_started(const PStatCollector self, const PStatThread thread)

/**
  • Returns true if this particular collector has been started on the default

  • thread, or false otherwise.

*/

/**
  • Returns true if this particular collector has been started on the indicated

  • thread, or false otherwise.

*/

is_valid()

C++ Interface: is_valid(PStatCollector self)

/**
  • 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).

*/

output()

C++ Interface: output(PStatCollector self, ostream out)

/**

*/

setLevel()

C++ Interface: set_level(const PStatCollector self, double level) set_level(const PStatCollector self, const PStatThread thread, double level)

/**
  • Sets the level setting associated with this collector for the main thread

  • to the indicated value. This implicitly calls flush_level().

*/

/**
  • Sets the level setting associated with this collector for the indicated

  • thread to the indicated value.

*/

setThreadLevel()

C++ Interface: set_thread_level(const PStatCollector self, double level)

/**
  • Sets the level setting associated with this collector for the current

  • thread to the indicated value.

*/

set_level()

C++ Interface: set_level(const PStatCollector self, double level) set_level(const PStatCollector self, const PStatThread thread, double level)

/**
  • Sets the level setting associated with this collector for the main thread

  • to the indicated value. This implicitly calls flush_level().

*/

/**
  • Sets the level setting associated with this collector for the indicated

  • thread to the indicated value.

*/

set_thread_level()

C++ Interface: set_thread_level(const PStatCollector self, double level)

/**
  • Sets the level setting associated with this collector for the current

  • thread to the indicated value.

*/

start()

C++ Interface: start(const PStatCollector self) start(const PStatCollector self, const PStatThread thread) start(const PStatCollector self, const PStatThread thread, double as_of)

/**
  • Starts this particular timer ticking. This should be called before the

  • code you want to measure.

*/

/**
  • Starts this timer ticking within a particular thread.

*/

/**
  • 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()

C++ Interface: stop(const PStatCollector self) stop(const PStatCollector self, const PStatThread thread) stop(const PStatCollector self, const PStatThread thread, double as_of)

/**
  • Stops this timer. This should be called after the code you want to

  • measure.

*/

/**
  • Stops this timer within a particular thread.

*/

/**
  • 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()

C++ Interface: sub_level(const PStatCollector self, double decrement) sub_level(const PStatCollector self, const PStatThread thread, double decrement)

/**
  • 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.

*/

/**
  • 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()

C++ Interface: sub_level_now(const PStatCollector self, double decrement)

/**
  • Calls sub_level() and immediately calls flush_level().

*/

subThreadLevel()

C++ Interface: sub_thread_level(const PStatCollector self, double decrement)

/**
  • 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.

*/

sub_level()

C++ Interface: sub_level(const PStatCollector self, double decrement) sub_level(const PStatCollector self, const PStatThread thread, double decrement)

/**
  • 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.

*/

/**
  • 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.

*/

sub_level_now()

C++ Interface: sub_level_now(const PStatCollector self, double decrement)

/**
  • Calls sub_level() and immediately calls flush_level().

*/

sub_thread_level()

C++ Interface: sub_thread_level(const PStatCollector self, double decrement)

/**
  • 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.

*/