Panda3D
|
A lightweight class that represents a single element that may be timed and/or counted via stats. More...
Public Member Functions | |
PStatCollector (PStatCollector const copy) | |
PStatCollector (PStatCollector const parent, string name) | |
Creates a new PStatCollector, ready to start accumulating data. | |
PStatCollector (string name) | |
Creates a new PStatCollector, ready to start accumulating data. | |
PStatCollector (string name, PStatClient client) | |
Creates a new PStatCollector, ready to start accumulating data. | |
addLevel (PStatThread const thread, double increment) | |
Adds the indicated increment (which may be negative) to the level setting associated with this collector for the indicated thread. | |
addLevel (double increment) | |
Adds the indicated increment (which may be negative) to the level setting associated with this collector for the main thread. | |
addLevelNow (double increment) | |
Calls add_level() and immediately calls flush_level(). | |
addThreadLevel (double increment) | |
Adds the indicated increment (which may be negative) to the level setting associated with this collector for the current thread. | |
clearLevel () | |
Removes the level setting associated with this collector for the main thread. | |
clearLevel (PStatThread const thread) | |
Removes the level setting associated with this collector for the indicated thread. | |
clearThreadLevel () | |
Removes the level setting associated with this collector for the current thread. | |
flushLevel () | |
Updates the PStatClient with the recent results from add_level() and sub_level(). | |
string | getFullname () |
Returns the full name of this collector. | |
int | getIndex () |
Returns the index number of this particular collector within the PStatClient. | |
double | getLevel (PStatThread const thread) |
Returns the current level value of the given collector. | |
double | getLevel () |
Returns the current level value of the given collector in the main thread. | |
string | getName () |
Returns the local name of this collector. | |
double | getThreadLevel () |
Returns the current level value of the given collector in the current thread. | |
bool | isActive () |
Returns true if this particular collector is active on the default thread, and we are currently transmitting PStats data. | |
bool | isActive (PStatThread const thread) |
Returns true if this particular collector is active on the indicated thread, and we are currently transmitting PStats data. | |
bool | isStarted () |
Returns true if this particular collector has been started on the default thread, or false otherwise. | |
bool | isStarted (PStatThread const thread) |
Returns true if this particular collector has been started on the indicated thread, or false otherwise. | |
bool | isValid () |
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). | |
PStatCollector | operator= (PStatCollector const copy) |
output (ostream out) | |
setLevel (PStatThread const thread, double level) | |
Sets the level setting associated with this collector for the indicated thread to the indicated value. | |
setLevel (double level) | |
Sets the level setting associated with this collector for the main thread to the indicated value. | |
setThreadLevel (double level) | |
Sets the level setting associated with this collector for the current thread to the indicated value. | |
start (PStatThread const thread) | |
Starts this timer ticking within a particular thread. | |
start (PStatThread const thread, float as_of) | |
Marks that the timer should have been started as of the indicated time. | |
start () | |
Starts this particular timer ticking. | |
stop (PStatThread const thread, float as_of) | |
Marks that the timer should have been stopped as of the indicated time. | |
stop (PStatThread const thread) | |
Stops this timer within a particular thread. | |
stop () | |
Stops this timer. | |
subLevel (double decrement) | |
Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the main thread. | |
subLevel (PStatThread const thread, double decrement) | |
Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the indicated thread. | |
subLevelNow (double decrement) | |
Calls sub_level() and immediately calls flush_level(). | |
subThreadLevel (double decrement) | |
Subtracts the indicated decrement (which may be negative) to the level setting associated with this collector for the current thread. |
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().
PStatCollector | ( | PStatCollector const | copy | ) |
PStatCollector | ( | PStatCollector const | parent, |
string | name | ||
) |
Creates a new PStatCollector, ready to start accumulating data.
The name of the collector uniquely identifies it among the other collectors; if two collectors share the same name then they are really the same collector.
The parent is the collector that conceptually includes all of the time measured for this collector. For instance, a particular character's animation time is owned by the "Animation" collector, which is in turn owned by the "Frame" collector. It is not strictly necessary that all of the time spent in a particular collector is completely nested within time spent in its parent's collector. If parent is the empty string, the collector is owned by "Frame".
This constructor does not take a client pointer; it always creates the new collector on the same client as its parent.
PStatCollector | ( | string | name, |
PStatClient | client | ||
) |
Creates a new PStatCollector, ready to start accumulating data.
The name of the collector uniquely identifies it among the other collectors; if two collectors share the same name then they are really the same collector.
The name may also be a compound name, something like "Cull:Sort", which indicates that this is a collector named "Sort", a child of the collector named "Cull". The parent may also be named explicitly by reference in the other flavor of the constructor; see further comments on this for that constructor.
If the client pointer is non-null, it specifies a particular client to register the collector with; otherwise, the global client is used.
PStatCollector | ( | string | name | ) |
Creates a new PStatCollector, ready to start accumulating data.
The name of the collector uniquely identifies it among the other collectors; if two collectors share the same name then they are really the same collector.
The name may also be a compound name, something like "Cull:Sort", which indicates that this is a collector named "Sort", a child of the collector named "Cull". The parent may also be named explicitly by reference in the other flavor of the constructor; see further comments on this for that constructor.
If the client pointer is non-null, it specifies a particular client to register the collector with; otherwise, the global client is used.
addLevel | ( | PStatThread const | thread, |
double | increment | ||
) |
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.
addLevel | ( | 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 0.
As an optimization, the data is not immediately set to the PStatClient. It will be sent the next time flush_level() is called.
addLevelNow | ( | double | increment | ) |
Calls add_level() and immediately calls flush_level().
addThreadLevel | ( | 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.
clearLevel | ( | ) |
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().
clearLevel | ( | PStatThread const | thread | ) |
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 | ( | ) |
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 | ( | ) |
Updates the PStatClient with the recent results from add_level() and sub_level().
string getFullname | ( | ) |
Returns the full name of this collector.
This includes the names of all the collector's parents, concatenated together with colons.
int getIndex | ( | ) |
Returns the index number of this particular collector within the PStatClient.
double getLevel | ( | ) |
Returns the current level value of the given collector in the main thread.
This implicitly calls flush_level().
double getLevel | ( | PStatThread const | thread | ) |
Returns the current level value of the given collector.
string getName | ( | ) |
Returns the local name of this collector.
This is the rightmost part of the fullname, after the rightmost colon.
double getThreadLevel | ( | ) |
Returns the current level value of the given collector in the current thread.
bool isActive | ( | ) |
Returns true if this particular collector is active on the default thread, and we are currently transmitting PStats data.
bool isActive | ( | PStatThread const | thread | ) |
Returns true if this particular collector is active on the indicated thread, and we are currently transmitting PStats data.
bool isStarted | ( | PStatThread const | thread | ) |
Returns true if this particular collector has been started on the indicated thread, or false otherwise.
bool isStarted | ( | ) |
Returns true if this particular collector has been started on the default thread, or false otherwise.
bool isValid | ( | ) |
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).
PStatCollector operator= | ( | PStatCollector const | copy | ) |
output | ( | ostream | out | ) |
setLevel | ( | PStatThread const | thread, |
double | level | ||
) |
Sets the level setting associated with this collector for the indicated thread to the indicated value.
setLevel | ( | double | level | ) |
Sets the level setting associated with this collector for the main thread to the indicated value.
This implicitly calls flush_level().
setThreadLevel | ( | double | level | ) |
Sets the level setting associated with this collector for the current thread to the indicated value.
start | ( | PStatThread const | thread | ) |
Starts this timer ticking within a particular thread.
start | ( | PStatThread const | thread, |
float | as_of | ||
) |
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.
start | ( | ) |
Starts this particular timer ticking.
This should be called before the code you want to measure.
stop | ( | ) |
Stops this timer.
This should be called after the code you want to measure.
stop | ( | PStatThread const | thread | ) |
Stops this timer within a particular thread.
stop | ( | PStatThread const | thread, |
float | as_of | ||
) |
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 | ( | 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.
subLevel | ( | PStatThread const | thread, |
double | decrement | ||
) |
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 | ( | double | decrement | ) |
Calls sub_level() and immediately calls flush_level().
subThreadLevel | ( | 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.