23 INLINE
void PStatClient::
24 set_client_name(
const string &name) {
25 get_impl()->set_client_name(name);
33 INLINE
string PStatClient::
34 get_client_name()
const {
35 return get_impl()->get_client_name();
53 INLINE
void PStatClient::
54 set_max_rate(
double rate) {
55 get_impl()->set_max_rate(rate);
65 INLINE
double PStatClient::
66 get_max_rate()
const {
67 return get_impl()->get_max_rate();
76 INLINE
int PStatClient::
77 get_num_collectors()
const {
79 return _num_collectors;
88 get_collector_def(
int index)
const {
89 nassertr(index >= 0 && index < _num_collectors, NULL);
91 return get_collector_ptr(index)->get_def(
this, index);
100 INLINE
int PStatClient::
101 get_num_threads()
const {
111 INLINE
string PStatClient::
112 get_thread_name(
int index)
const {
114 return get_thread_ptr(index)->_name;
122 INLINE
string PStatClient::
123 get_thread_sync_name(
int index)
const {
125 return get_thread_ptr(index)->_sync_name;
134 INLINE
Thread *PStatClient::
135 get_thread_object(
int index)
const {
137 InternalThread *thread = get_thread_ptr(index);
138 if (thread->_thread.was_deleted()) {
141 return thread->_thread;
153 INLINE
double PStatClient::
154 get_real_time()
const {
156 return _impl->get_real_time();
169 connect(
const string &hostname,
int port) {
170 return get_global_pstats()->client_connect(hostname, port);
180 get_global_pstats()->client_disconnect();
191 return get_global_pstats()->client_is_connected();
204 get_global_pstats()->client_resume_after_pause();
212 INLINE
bool PStatClient::
213 client_connect(
string hostname,
int port) {
216 return get_impl()->client_connect(hostname, port);
224 INLINE
bool PStatClient::
225 client_is_connected()
const {
226 return has_impl() && _impl->client_is_connected();
237 INLINE
void PStatClient::
238 client_resume_after_pause() {
240 _impl->client_resume_after_pause();
250 INLINE
bool PStatClient::
252 return (_impl != (PStatClientImpl *)NULL);
262 INLINE PStatClientImpl *PStatClient::
265 if (_impl == (PStatClientImpl *)NULL) {
266 _impl =
new PStatClientImpl(
this);
279 INLINE
const PStatClientImpl *PStatClient::
290 INLINE PStatClient::Collector *PStatClient::
291 get_collector_ptr(
int collector_index)
const {
293 return collectors[collector_index];
302 INLINE PStatClient::InternalThread *PStatClient::
303 get_thread_ptr(
int thread_index)
const {
305 return threads[thread_index];
313 INLINE PStatClient::Collector::
314 Collector(
int parent_index,
const string &name) :
316 _parent_index(parent_index),
326 INLINE
int PStatClient::Collector::
327 get_parent_index()
const {
328 return _parent_index;
336 INLINE
const string &PStatClient::Collector::
349 INLINE
bool PStatClient::Collector::
362 get_def(
const PStatClient *client,
int this_index)
const {
364 ((Collector *)
this)->make_def(client, this_index);
static Pointer get_ptr(const Pointer &var)
Atomically retrieves the snapshot value of the indicated variable.
static bool connect(const string &=string(), int=-1)
Attempts to establish a connection to the indicated PStatServer.
static void resume_after_pause()
Resumes the PStatClient after the simulation has been paused for a while.
static void disconnect()
Closes the connection previously established.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
Similar to MutexHolder, but for a reentrant mutex.
A thread; that is, a lightweight process.
static bool is_connected()
Returns true if the client believes it is connected to a working PStatServer, false otherwise...
Defines the details about the Collectors: the name, the suggested color, etc.
Manages the communications to report statistics via a network connection to a remote PStatServer...