17INLINE
int PStatClient::
18get_num_collectors()
const {
20 return (
int)_num_collectors;
27get_collector_def(
int index)
const {
28 nassertr(index >= 0 && index < _num_collectors,
nullptr);
30 return get_collector_ptr(index)->get_def(
this, index);
39 return (
int)_num_threads;
48 return get_thread_ptr(index)->_name;
57 return get_thread_ptr(index)->_sync_name;
64get_thread_object(
int index)
const {
66 InternalThread *thread = get_thread_ptr(index);
67 return thread->_thread.lock();
74INLINE
bool PStatClient::
75connect(
const std::string &hostname,
int port) {
76 return get_global_pstats()->client_connect(hostname, port);
84 get_global_pstats()->client_disconnect();
93 return get_global_pstats()->client_is_connected();
103 get_global_pstats()->client_resume_after_pause();
110INLINE
bool PStatClient::
112 return (_impl !=
nullptr);
119INLINE PStatClientImpl *PStatClient::
122 if (_impl ==
nullptr) {
132INLINE
const PStatClientImpl *PStatClient::
135 if (_impl ==
nullptr) {
145INLINE PStatClient::Collector *PStatClient::
146get_collector_ptr(
int collector_index)
const {
148 return collectors[collector_index];
154INLINE PStatClient::InternalThread *PStatClient::
155get_thread_ptr(
int thread_index)
const {
157 return threads[thread_index];
163INLINE PStatClient::Collector::
164Collector(
int parent_index,
const std::string &name) :
166 _parent_index(parent_index),
174INLINE
int PStatClient::Collector::
175get_parent_index()
const {
176 return _parent_index;
182INLINE
const std::string &PStatClient::Collector::
192INLINE
bool PStatClient::Collector::
194 return _def !=
nullptr && _def->_is_active;
202get_def(
const PStatClient *client,
int this_index)
const {
203 if (_def ==
nullptr) {
204 ((Collector *)
this)->make_def(client, this_index);
static Pointer get_ptr(const Pointer &var)
Atomically retrieves the snapshot value of the indicated variable.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
Manages the communications to report statistics via a network connection to a remote PStatServer.
std::string get_thread_sync_name(int index) const
Returns the sync_name of the indicated thread.
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.
int get_num_threads() const
Returns the total number of threads the Client knows about.
static bool is_connected()
Returns true if the client believes it is connected to a working PStatServer, false otherwise.
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
Defines the details about the Collectors: the name, the suggested color, etc.
Similar to MutexHolder, but for a reentrant mutex.
A thread; that is, a lightweight process.