Manages the communications to report statistics via a network connection to a remote PStatServer. More...
Public Member Functions | |
bool | clientConnect (string hostname, int port) |
The nonstatic implementation of connect(). | |
clientDisconnect () | |
The nonstatic implementation of disconnect(). | |
bool | clientIsConnected () |
The nonstatic implementation of is_connected(). | |
clientMainTick () | |
A convenience function to call new_frame() on the given PStatClient's main thread, and any other threads with a sync_name of "Main". | |
clientResumeAfterPause () | |
Resumes the PStatClient after the simulation has been paused for a while. | |
clientThreadTick (string sync_name) | |
A convenience function to call new_frame() on all of the threads with the indicated sync name. | |
string | getClientName () |
Retrieves the name of the client as set. | |
PStatCollector | getCollector (int index) |
Returns the nth collector. | |
PStatCollectorDef | getCollectorDef (int index) |
Returns the definition body of the nth collector. | |
string | getCollectorFullname (int index) |
Returns the "full name" of the indicated collector. | |
string | getCollectorName (int index) |
Returns the name of the indicated collector. | |
list | getCollectors () |
PStatThread | getCurrentThread () |
Returns a handle to the currently-executing thread. | |
PStatThread | getMainThread () |
Returns a handle to the client's Main thread. | |
double | getMaxRate () |
Returns the maximum number of packets that will be sent to the server per second, per thread. | |
int | getNumCollectors () |
Returns the total number of collectors the Client knows about. | |
int | getNumThreads () |
Returns the total number of threads the Client knows about. | |
double | getRealTime () |
Returns the time according to to the PStatClient's clock object. | |
PStatThread | getThread (int index) |
Returns the nth thread. | |
string | getThreadName (int index) |
Returns the name of the indicated thread. | |
Thread | getThreadObject (int index) |
Returns the Panda Thread object associated with the indicated PStatThread. | |
list | getThreads () |
string | getThreadSyncName (int index) |
Returns the sync_name of the indicated thread. | |
setClientName (string name) | |
Sets the name of the client. | |
setMaxRate (double rate) | |
Controls the number of packets that will be sent to the server. | |
Static Public Member Functions | |
static bool | connect (string hostname, int port) |
Attempts to establish a connection to the indicated PStatServer. | |
static bool | connect (string hostname) |
Attempts to establish a connection to the indicated PStatServer. | |
static bool | connect () |
Attempts to establish a connection to the indicated PStatServer. | |
static | disconnect () |
Closes the connection previously established. | |
static PStatClient | getGlobalPstats () |
Returns a pointer to the global PStatClient object. | |
static bool | isConnected () |
Returns true if the client believes it is connected to a working PStatServer, false otherwise. | |
static | mainTick () |
A convenience function to call new_frame() on the global PStatClient's main thread, and any other threads with a sync_name of "Main". | |
static | resumeAfterPause () |
Resumes the PStatClient after the simulation has been paused for a while. | |
static | threadTick (string sync_name) |
A convenience function to call new_frame() on any threads with the indicated sync_name. |
Manages the communications to report statistics via a network connection to a remote PStatServer.
Normally, there is only one PStatClient in the world, although it is possible to have multiple PStatClients if extraordinary circumstances require in. Since each PStatCollector registers itself with the PStatClient when it is created, having multiple PStatClients requires special care when constructing the various PStatCollectors.
If DO_PSTATS is not defined, we don't want to use stats at all. This class is therefore defined as a stub class.
bool clientConnect | ( | string | hostname, |
int | port | ||
) |
The nonstatic implementation of connect().
clientDisconnect | ( | ) |
The nonstatic implementation of disconnect().
bool clientIsConnected | ( | ) |
The nonstatic implementation of is_connected().
clientMainTick | ( | ) |
A convenience function to call new_frame() on the given PStatClient's main thread, and any other threads with a sync_name of "Main".
Resumes the PStatClient after the simulation has been paused for a while.
This allows the stats to continue exactly where it left off, instead of leaving a big gap that would represent a chug.
clientThreadTick | ( | string | sync_name | ) |
A convenience function to call new_frame() on all of the threads with the indicated sync name.
Attempts to establish a connection to the indicated PStatServer.
Returns true if successful, false on failure.
static bool connect | ( | string | hostname | ) | [static] |
Attempts to establish a connection to the indicated PStatServer.
Returns true if successful, false on failure.
static bool connect | ( | ) | [static] |
Attempts to establish a connection to the indicated PStatServer.
Returns true if successful, false on failure.
static disconnect | ( | ) | [static] |
Closes the connection previously established.
string getClientName | ( | ) |
Retrieves the name of the client as set.
PStatCollector getCollector | ( | int | index | ) |
Returns the nth collector.
PStatCollectorDef getCollectorDef | ( | int | index | ) |
Returns the definition body of the nth collector.
string getCollectorFullname | ( | int | index | ) |
Returns the "full name" of the indicated collector.
This will be the concatenation of all of the collector's parents' names (except Frame) and the collector's own name.
string getCollectorName | ( | int | index | ) |
Returns the name of the indicated collector.
list getCollectors | ( | ) |
Returns a handle to the currently-executing thread.
This is the thread that PStatCollectors will be counted in if they do not specify otherwise.
static PStatClient getGlobalPstats | ( | ) | [static] |
Returns a pointer to the global PStatClient object.
It's legal to declare your own PStatClient locally, but it's also convenient to have a global one that everyone can register with. This is the global one.
Returns a handle to the client's Main thread.
This is the thread that started the application.
double getMaxRate | ( | ) |
Returns the maximum number of packets that will be sent to the server per second, per thread.
See set_max_rate().
int getNumCollectors | ( | ) |
Returns the total number of collectors the Client knows about.
int getNumThreads | ( | ) |
Returns the total number of threads the Client knows about.
double getRealTime | ( | ) |
Returns the time according to to the PStatClient's clock object.
It keeps its own clock, instead of using the global clock object, so the stats won't get mucked up if you put the global clock in non-real-time mode or something.
PStatThread getThread | ( | int | index | ) |
Returns the nth thread.
string getThreadName | ( | int | index | ) |
Returns the name of the indicated thread.
Thread getThreadObject | ( | int | index | ) |
Returns the Panda Thread object associated with the indicated PStatThread.
list getThreads | ( | ) |
string getThreadSyncName | ( | int | index | ) |
Returns the sync_name of the indicated thread.
static bool isConnected | ( | ) | [static] |
Returns true if the client believes it is connected to a working PStatServer, false otherwise.
static mainTick | ( | ) | [static] |
A convenience function to call new_frame() on the global PStatClient's main thread, and any other threads with a sync_name of "Main".
static resumeAfterPause | ( | ) | [static] |
Resumes the PStatClient after the simulation has been paused for a while.
This allows the stats to continue exactly where it left off, instead of leaving a big gap that would represent a chug.
setClientName | ( | string | name | ) |
Sets the name of the client.
This is reported to the PStatsServer, and will presumably be written in the title bar or something.
setMaxRate | ( | double | rate | ) |
Controls the number of packets that will be sent to the server.
Normally, one packet is sent per frame, but this can flood the server with more packets than it can handle if the frame rate is especially good (e.g. if nothing is onscreen at the moment). Set this parameter to a reasonable number to prevent this from happening.
This number specifies the maximum number of packets that will be sent to the server per second, per thread.
static threadTick | ( | string | sync_name | ) | [static] |
A convenience function to call new_frame() on any threads with the indicated sync_name.