PStatClient
-
class PStatClient
Bases:
PStatsCallback
Inheritance diagram
-
void client_disconnect(void)
The nonstatic implementation of
disconnect()
.
-
bool client_is_connected(void) const
The nonstatic implementation of
is_connected()
.
-
void client_main_tick(void)
A convenience function to call new_frame() on the given PStatClient’s main thread, and any other threads with a sync_name of “Main”.
-
void client_resume_after_pause(void)
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.
-
void client_thread_tick(void)
-
void client_thread_tick(std::string const &sync_name)
A convenience function to call new_frame() on the current thread.
A convenience function to call new_frame() on all of the threads with the indicated sync name.
-
bool connect(std::string const &hostname = string(), int port = -1)
Attempts to establish a connection to the indicated PStatServer. Returns true if successful, false on failure.
-
void disconnect(void)
Closes the connection previously established.
-
std::string get_client_name(void) const
Retrieves the name of the client as set.
-
PStatCollector get_collector(int index) const
Returns the nth collector.
-
PStatCollectorDef *get_collector_def(int index) const
Returns the definition body of the nth collector.
-
std::string get_collector_fullname(int index) const
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.
-
std::string get_collector_name(int index) const
Returns the name of the indicated collector.
-
PStatThread get_current_thread(void) const
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 *get_global_pstats(void)
Returns a pointer to the global
PStatClient
object. It’s legal to declare your ownPStatClient
locally, but it’s also convenient to have a global one that everyone can register with. This is the global one.
-
PStatThread get_main_thread(void) const
Returns a handle to the client’s Main thread. This is the thread that started the application.
-
double get_max_rate(void) const
Returns the maximum number of packets that will be sent to the server per second, per thread. See
set_max_rate()
.
-
int get_num_collectors(void) const
Returns the total number of collectors the Client knows about.
-
int get_num_threads(void) const
Returns the total number of threads the Client knows about.
-
double get_real_time(void) const
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 get_thread(int index) const
Returns the nth thread.
-
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
-
PointerTo<Thread> get_thread_object(int index) const
Returns the Panda Thread object associated with the indicated
PStatThread
.
-
std::string get_thread_sync_name(int index) const
Returns the sync_name of the indicated thread.
-
bool is_connected(void)
Returns true if the client believes it is connected to a working PStatServer, false otherwise.
-
static void main_tick(void)
A convenience function to call new_frame() on the global PStatClient’s main thread, and any other threads with a sync_name of “Main”.
-
void resume_after_pause(void)
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.
-
void set_client_name(std::string const &name)
Sets the name of the client. This is reported to the PStatsServer, and will presumably be written in the title bar or something.
-
void set_max_rate(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 void thread_tick(void)
-
static void thread_tick(std::string const &sync_name)
A convenience function to call new_frame() for the current thread.
A convenience function to call new_frame() on any threads with the indicated sync_name
-
void client_disconnect(void)