panda3d.core.PStatClient

from panda3d.core import PStatClient
class PStatClient

Bases: ThreadPStatsCallback

Inheritance diagram

Inheritance diagram of PStatClient

setClientName(name: str) → None

Sets the name of the client. This is reported to the PStatsServer, and will presumably be written in the title bar or something.

getClientName() → str

Retrieves the name of the client as set.

setMaxRate(rate: float) → None

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.

getMaxRate() → float

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

getNumCollectors() → int

Returns the total number of collectors the Client knows about.

getCollector(index: int) → PStatCollector

Returns the nth collector.

Return type

PStatCollector

getCollectorDef(index: int) → PStatCollectorDef

Returns the definition body of the nth collector.

Return type

PStatCollectorDef

getCollectorName(index: int) → str

Returns the name of the indicated collector.

getCollectorFullname(index: int) → str

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.

getNumThreads() → int

Returns the total number of threads the Client knows about.

getThread(index: int) → PStatThread

Returns the nth thread.

Return type

PStatThread

getThreadName(index: int) → str

Returns the name of the indicated thread.

getThreadSyncName(index: int) → str

Returns the sync_name of the indicated thread.

getThreadObject(index: int) → Thread

Returns the Panda Thread object associated with the indicated PStatThread.

Return type

Thread

getMainThread() → PStatThread

Returns a handle to the client’s Main thread. This is the thread that started the application.

Return type

PStatThread

getCurrentThread() → PStatThread

Returns a handle to the currently-executing thread. This is the thread that PStatCollectors will be counted in if they do not specify otherwise.

Return type

PStatThread

getRealTime() → float

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.

static connect(hostname: str, port: int) → bool

Attempts to establish a connection to the indicated PStatServer. Returns true if successful, false on failure.

static disconnect() → None

Closes the connection previously established.

static isConnected() → bool

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

static resumeAfterPause() → None

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.

static mainTick() → None

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 threadTick(sync_name: str) → None

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

clientMainTick() → None

A convenience function to call new_frame() on the given PStatClient’s main thread, and any other threads with a sync_name of “Main”.

clientThreadTick(sync_name: str) → None

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

clientConnect(hostname: str, port: int) → bool

The nonstatic implementation of connect().

clientDisconnect() → None

The nonstatic implementation of disconnect().

clientIsConnected() → bool

The nonstatic implementation of isConnected().

clientResumeAfterPause() → None

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.

static getGlobalPstats() → PStatClient

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.

Return type

PStatClient

getCollectors() → list
getThreads() → list
property client_name
Getter

Retrieves the name of the client as set.

Setter

Sets the name of the client. This is reported to the PStatsServer, and will presumably be written in the title bar or something.

Return type

string

property max_rate
Getter

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

Setter

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.

Return type

float

property collectors

Returns the nth collector.

Return type

Sequence[PStatCollector]

property threads

Returns the nth thread.

Return type

Sequence[PStatThread]

property main_thread

Returns a handle to the client’s Main thread. This is the thread that started the application.

Return type

PStatThread

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

Return type

PStatThread

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

Return type

float