Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PStatClient Class Reference
Inheritance diagram for PStatClient:

Public Member Functions

bool clientConnect (str hostname, int port)
 The nonstatic implementation of connect(). More...
 
 clientDisconnect ()
 The nonstatic implementation of disconnect(). More...
 
bool clientIsConnected ()
 The nonstatic implementation of is_connected(). More...
 
 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". More...
 
 clientResumeAfterPause ()
 Resumes the PStatClient after the simulation has been paused for a while. More...
 
 clientThreadTick (str sync_name)
 A convenience function to call new_frame() on all of the threads with the indicated sync name. More...
 
str getClientName ()
 Retrieves the name of the client as set. More...
 
PStatCollector getCollector (int index)
 Returns the nth collector. More...
 
PStatCollectorDef getCollectorDef (int index)
 Returns the definition body of the nth collector. More...
 
str getCollectorFullname (int index)
 Returns the "full name" of the indicated collector. More...
 
str getCollectorName (int index)
 Returns the name of the indicated collector. More...
 
list getCollectors ()
 
PStatThread getCurrentThread ()
 Returns a handle to the currently-executing thread. More...
 
PStatThread getMainThread ()
 Returns a handle to the client's Main thread. More...
 
double getMaxRate ()
 Returns the maximum number of packets that will be sent to the server per second, per thread. More...
 
int getNumCollectors ()
 Returns the total number of collectors the Client knows about. More...
 
int getNumThreads ()
 Returns the total number of threads the Client knows about. More...
 
double getRealTime ()
 Returns the time according to to the PStatClient's clock object. More...
 
PStatThread getThread (int index)
 Returns the nth thread. More...
 
str getThreadName (int index)
 Returns the name of the indicated thread. More...
 
Thread getThreadObject (int index)
 Returns the Panda Thread object associated with the indicated PStatThread. More...
 
list getThreads ()
 
str getThreadSyncName (int index)
 Returns the sync_name of the indicated thread. More...
 
 setClientName (str name)
 Sets the name of the client. More...
 
 setMaxRate (double rate)
 Controls the number of packets that will be sent to the server. More...
 

Static Public Member Functions

static bool connect (str hostname, int port)
 Attempts to establish a connection to the indicated PStatServer. More...
 
static disconnect ()
 Closes the connection previously established. More...
 
static PStatClient getGlobalPstats ()
 Returns a pointer to the global PStatClient object. More...
 
static bool isConnected ()
 Returns true if the client believes it is connected to a working PStatServer, false otherwise. More...
 
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". More...
 
static resumeAfterPause ()
 Resumes the PStatClient after the simulation has been paused for a while. More...
 
static threadTick (str sync_name)
 A convenience function to call new_frame() on any threads with the indicated sync_name. More...
 

Public Attributes

String client_name
 Retrieves the name of the client as set. More...
 
PStatCollector collectors []
 
PStatThread current_thread
 Returns a handle to the currently-executing thread. More...
 
PStatThread main_thread
 Returns a handle to the client's Main thread. More...
 
double max_rate
 Returns the maximum number of packets that will be sent to the server per second, per thread. More...
 
double real_time
 Returns the time according to to the PStatClient's clock object. More...
 
PStatThread threads []
 

Member Function Documentation

◆ clientConnect()

bool clientConnect ( str  hostname,
int  port 
)

The nonstatic implementation of connect().

◆ clientDisconnect()

clientDisconnect ( )

The nonstatic implementation of disconnect().

◆ clientIsConnected()

bool clientIsConnected ( )

The nonstatic implementation of is_connected().

◆ clientMainTick()

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()

clientResumeAfterPause ( )

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()

clientThreadTick ( str  sync_name)

A convenience function to call new_frame() on all of the threads with the indicated sync name.

◆ connect()

static bool connect ( str  hostname,
int  port 
)
static

Attempts to establish a connection to the indicated PStatServer.

Returns true if successful, false on failure.

◆ disconnect()

static disconnect ( )
static

Closes the connection previously established.

◆ getClientName()

str getClientName ( )

Retrieves the name of the client as set.

◆ getCollector()

PStatCollector getCollector ( int  index)

Returns the nth collector.

◆ getCollectorDef()

PStatCollectorDef getCollectorDef ( int  index)

Returns the definition body of the nth collector.

◆ getCollectorFullname()

str 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.

◆ getCollectorName()

str getCollectorName ( int  index)

Returns the name of the indicated collector.

◆ getCollectors()

list getCollectors ( )

◆ getCurrentThread()

PStatThread getCurrentThread ( )

Returns a handle to the currently-executing thread.

This is the thread that PStatCollectors will be counted in if they do not specify otherwise.

◆ getGlobalPstats()

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.

◆ getMainThread()

PStatThread getMainThread ( )

Returns a handle to the client's Main thread.

This is the thread that started the application.

◆ getMaxRate()

double getMaxRate ( )

Returns the maximum number of packets that will be sent to the server per second, per thread.

See set_max_rate().

◆ getNumCollectors()

int getNumCollectors ( )

Returns the total number of collectors the Client knows about.

◆ getNumThreads()

int getNumThreads ( )

Returns the total number of threads the Client knows about.

◆ getRealTime()

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.

◆ getThread()

PStatThread getThread ( int  index)

Returns the nth thread.

◆ getThreadName()

str getThreadName ( int  index)

Returns the name of the indicated thread.

◆ getThreadObject()

Thread getThreadObject ( int  index)

Returns the Panda Thread object associated with the indicated PStatThread.

◆ getThreads()

list getThreads ( )

◆ getThreadSyncName()

str getThreadSyncName ( int  index)

Returns the sync_name of the indicated thread.

◆ isConnected()

static bool isConnected ( )
static

Returns true if the client believes it is connected to a working PStatServer, false otherwise.

◆ mainTick()

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".

◆ resumeAfterPause()

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()

setClientName ( str  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()

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.

◆ threadTick()

static threadTick ( str  sync_name)
static

A convenience function to call new_frame() on any threads with the indicated sync_name.

Member Data Documentation

◆ client_name

String client_name

Retrieves the name of the client as set.

◆ collectors

PStatCollector collectors[]

◆ current_thread

PStatThread current_thread

Returns a handle to the currently-executing thread.

This is the thread that PStatCollectors will be counted in if they do not specify otherwise.

◆ main_thread

PStatThread main_thread

Returns a handle to the client's Main thread.

This is the thread that started the application.

◆ max_rate

double max_rate

Returns the maximum number of packets that will be sent to the server per second, per thread.

See set_max_rate().

◆ real_time

double real_time

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.

◆ threads

PStatThread threads[]