PStatClient

from panda3d.core import PStatClient
class PStatClient

Bases:

Bases: Thread.PStatsCallback

Inheritance diagram

Inheritance diagram of PStatClient

client_connect(hostname: str, port: int) bool

The nonstatic implementation of connect().

client_disconnect()

The nonstatic implementation of disconnect().

client_is_connected() bool

The nonstatic implementation of is_connected().

client_main_tick()

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

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

client_resume_after_pause()

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.

client_thread_tick()

A convenience function to call new_frame() on the current thread.

client_thread_tick(sync_name: str)

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

property collectors Sequence[PStatCollector]

Returns the nth collector.

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

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

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

static disconnect()

Closes the connection previously established.

get_client_name() str

Retrieves the name of the client as set.

get_collector(index: int) PStatCollector

Returns the nth collector.

get_collector_def(index: int) PStatCollectorDef

Returns the definition body of the nth collector.

get_collector_fullname(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.

get_collector_name(index: int) str

Returns the name of the indicated collector.

get_collectors() list
get_current_thread() 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.

static get_global_pstats() 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.

get_main_thread() PStatThread

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

get_max_rate() float

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

get_num_collectors() int

Returns the total number of collectors the Client knows about.

get_num_threads() int

Returns the total number of threads the Client knows about.

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

get_thread(index: int) PStatThread

Returns the nth thread.

get_thread_name(index: int) str

Returns the name of the indicated thread.

get_thread_object(index: int) Thread

Returns the Panda Thread object associated with the indicated PStatThread.

get_thread_sync_name(index: int) str

Returns the sync_name of the indicated thread.

get_threads() list
static is_connected() bool

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

property main_thread PStatThread

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

static main_tick()

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

property max_rate float
Getter

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

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.

property real_time 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 resume_after_pause()

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.

Deprecated: Do not use this, it creates inaccurate timing information.

set_client_name(name: str)

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

set_max_rate(rate: float)

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

A convenience function to call new_frame() for the current thread.

static thread_tick(sync_name: str)

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

property threads Sequence[PStatThread]

Returns the nth thread.