PStatClient

Inheritance:

Methods of PStatClient:

Methods of ConnectionManager:

clientConnect
bool PStatClient::client_connect(string hostname, int port);

Description: The nonstatic implementation of connect().

clientDisconnect
void PStatClient::client_disconnect(void);

Description: The nonstatic implementation of disconnect().

clientIsConnected
bool PStatClient::client_is_connected(void) const;

Description: The nonstatic implementation of is_connected().

clientMainTick
void PStatClient::client_main_tick(void);

Description: 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
void PStatClient::client_resume_after_pause(void);

Description: 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
void PStatClient::client_thread_tick(string const &sync_name);

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

connect
static bool PStatClient::connect(string const &hostname = ((string())), int port = (-1));

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

disconnect
static void PStatClient::disconnect(void);

Description: Closes the connection previously established.

getClientName
string PStatClient::get_client_name(void) const;

Description: Retrieves the name of the client as set.

getCollector
PStatCollector PStatClient::get_collector(int index) const;

Description: Returns the nth collector.

getCollectorDef
PStatCollectorDef *PStatClient::get_collector_def(int index) const;

Description: Returns the definition body of the nth collector.

getCollectorFullname
string PStatClient::get_collector_fullname(int index) const;

Description: 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
string PStatClient::get_collector_name(int index) const;

Description: Returns the name of the indicated collector.

getCurrentThread
PStatThread PStatClient::get_current_thread(void) const;

Description: 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 *PStatClient::get_global_pstats(void);

Description: 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 PStatClient::get_main_thread(void) const;

Description: Returns a handle to the client's Main thread. This is the thread that started the application.

getMaxRate
float PStatClient::get_max_rate(void) const;

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

getNumCollectors
int PStatClient::get_num_collectors(void) const;

Description: Returns the total number of collectors the Client knows about.

getNumThreads
int PStatClient::get_num_threads(void) const;

Description: Returns the total number of threads the Client knows about.

getRealTime
double PStatClient::get_real_time(void) const;

Description: 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 PStatClient::get_thread(int index) const;

Description: Returns the nth thread.

getThreadName
string PStatClient::get_thread_name(int index) const;

Description: Returns the name of the indicated thread.

getThreadObject
Thread *PStatClient::get_thread_object(int index) const;

Description: Returns the Panda Thread object associated with the indicated PStatThread.

getThreadSyncName
string PStatClient::get_thread_sync_name(int index) const;

Description: Returns the sync_name of the indicated thread.

isConnected
static bool PStatClient::is_connected(void);

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

mainTick
static void PStatClient::main_tick(void);

Description: 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 void PStatClient::resume_after_pause(void);

Description: 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
void PStatClient::set_client_name(string const &name);

Filename: pStatClient.I Created by: drose (16Jul00)
PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ .
To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net .
Description: Sets the name of the client. This is reported to the PStatsServer, and will presumably be written in the title bar or something.

setMaxRate
void PStatClient::set_max_rate(float rate);

Description: 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 void PStatClient::thread_tick(string const &sync_name);

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

closeConnection
bool ConnectionManager::close_connection(PointerTo< Connection > const &connection);

Description: Terminates a UDP or TCP socket previously opened. This also removes it from any associated ConnectionReader or ConnectionListeners.
The socket itself may not be immediately closed--it will not be closed until all outstanding pointers to it are cleared, including any pointers remaining in NetDatagrams recently received from the socket.
The return value is true if the connection was marked to be closed, or false if close_connection() had already been called (or the connection did not belong to this ConnectionManager). In neither case can you infer anything about whether the connection has
*actually* been closed yet based on the return value.

getHostName
static string ConnectionManager::get_host_name(void);

Description: Returns the name of this particular machine on the network, if available, or the empty string if the hostname cannot be determined.

openTCPClientConnection
PointerTo< Connection > ConnectionManager::open_TCP_client_connection(NetAddress const &address, int timeout_ms);

Description: 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.
Description: This is a shorthand version of the function to directly establish communications to a named host and port.

openTCPServerRendezvous
PointerTo< Connection > ConnectionManager::open_TCP_server_rendezvous(int port, int backlog);

Description: 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).
backlog is the maximum length of the queue of pending connections.

openUDPConnection
PointerTo< Connection > ConnectionManager::open_UDP_connection(int port = (0));

Description: 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.
Use a ConnectionReader and ConnectionWriter to handle the actual communication.