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

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. This allows the stats to continue exactly where it left off, instead of leaving a big gap that would represent a chug. 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. This will be the concatenation of all of the collector's parents' names (except Frame) and the collector's own name. 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. This is the thread that PStatCollectors will be counted in if they do not specify otherwise. More...
 
PStatThread getMainThread ()
 Returns a handle to the client's Main thread. This is the thread that started the application. More...
 
double getMaxRate ()
 Returns the maximum number of packets that will be sent to the server per second, per thread. See set_max_rate(). 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. 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. 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. This is reported to the PStatsServer, and will presumably be written in the title bar or something. More...
 
 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. More...
 
- Public Member Functions inherited from ConnectionManager
 __init__ ()
 
bool closeConnection (Connection connection)
 Terminates a UDP or TCP socket previously opened. This also removes it from any associated ConnectionReader or ConnectionListeners. More...
 
const ConnectionManager::Interface getInterface (int n)
 Returns the nth usable network interface detected on this machine. (Currently, only IPv4 interfaces are reported.) See scan_interfaces() to repopulate this list. More...
 
list getInterfaces ()
 
int getNumInterfaces ()
 This returns the number of usable network interfaces detected on this machine. (Currently, only IPv4 interfaces are reported.) See scan_interfaces() to repopulate this list. More...
 
Connection openTCPClientConnection (const NetAddress address, int timeout_ms)
 Attempts to establish a TCP client connection to a server at the indicated address. If the connection is not established within timeout_ms milliseconds, a null connection is returned. More...
 
Connection openTCPClientConnection (str hostname, int port, int timeout_ms)
 This is a shorthand version of the function to directly establish communications to a named host and port. More...
 
Connection openTCPServerRendezvous (const NetAddress address, int backlog)
 Creates a socket to be used as a rendezvous socket for a server to listen for TCP connections. The socket returned by this call should only be added to a ConnectionListener (not to a generic ConnectionReader). More...
 
Connection openTCPServerRendezvous (int port, int backlog)
 Creates a socket to be used as a rendezvous socket for a server to listen for TCP connections. The socket returned by this call should only be added to a ConnectionListener (not to a generic ConnectionReader). More...
 
Connection openTCPServerRendezvous (str hostname, int port, int backlog)
 Creates a socket to be used as a rendezvous socket for a server to listen for TCP connections. The socket returned by this call should only be added to a ConnectionListener (not to a generic ConnectionReader). More...
 
Connection openUDPConnection (int port)
 Opens a socket for sending and/or receiving UDP packets. If the port number is greater than zero, the UDP connection will be opened for listening on the indicated port; otherwise, it will be useful only for sending. More...
 
Connection openUDPConnection (str hostname, int port, bool for_broadcast)
 Opens a socket for sending and/or receiving UDP packets. If the port number is greater than zero, the UDP connection will be opened for listening on the indicated port; otherwise, it will be useful only for sending. More...
 
 scanInterfaces ()
 Repopulates the list reported by get_num_interface()/get_interface(). It is not necessary to call this explicitly, unless you want to re-determine the connected interfaces (for instance, if you suspect the hardware has recently changed). More...
 
bool waitForReaders (double timeout)
 Blocks the process for timeout number of seconds, or until any data is available on any of the non-threaded ConnectionReaders or ConnectionListeners, whichever comes first. The return value is true if there is data available (but you have to iterate through all readers to find it), or false if the timeout occurred without any data. More...
 

Static Public Member Functions

static bool connect (str hostname, int port)
 Attempts to establish a connection to the indicated PStatServer. Returns true if successful, false on failure. More...
 
static disconnect ()
 Closes the connection previously established. More...
 
static PStatClient getGlobalPstats ()
 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. 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. This allows the stats to continue exactly where it left off, instead of leaving a big gap that would represent a chug. More...
 
static threadTick (str sync_name)
 A convenience function to call new_frame() on any threads with the indicated sync_name. More...
 
- Static Public Member Functions inherited from ConnectionManager
static str getHostName ()
 Returns the name of this particular machine on the network, if available, or the empty string if the hostname cannot be determined. More...
 

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.