17 INLINE
int PStatClient::
18 get_num_collectors()
const {
20 return (
int)_num_collectors;
27 get_collector_def(
int index)
const {
28 nassertr(index >= 0 && index < _num_collectors,
nullptr);
30 return get_collector_ptr(index)->get_def(
this, index);
36 INLINE
int PStatClient::
37 get_num_threads()
const {
39 return (
int)_num_threads;
45 INLINE std::string PStatClient::
46 get_thread_name(
int index)
const {
48 return get_thread_ptr(index)->_name;
54 INLINE std::string PStatClient::
55 get_thread_sync_name(
int index)
const {
57 return get_thread_ptr(index)->_sync_name;
64 get_thread_object(
int index)
const {
66 InternalThread *thread = get_thread_ptr(index);
67 return thread->_thread.lock();
74 INLINE
bool PStatClient::
75 connect(
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();
110 INLINE
bool PStatClient::
112 return (_impl !=
nullptr);
119 INLINE PStatClientImpl *PStatClient::
122 if (_impl ==
nullptr) {
132 INLINE
const PStatClientImpl *PStatClient::
135 if (_impl ==
nullptr) {
145 INLINE PStatClient::Collector *PStatClient::
146 get_collector_ptr(
int collector_index)
const {
148 return collectors[collector_index];
154 INLINE PStatClient::InternalThread *PStatClient::
155 get_thread_ptr(
int thread_index)
const {
157 return threads[thread_index];
163 INLINE PStatClient::Collector::
164 Collector(
int parent_index,
const std::string &name) :
166 _parent_index(parent_index),
174 INLINE
int PStatClient::Collector::
175 get_parent_index()
const {
176 return _parent_index;
182 INLINE
const std::string &PStatClient::Collector::
192 INLINE
bool PStatClient::Collector::
194 return _def !=
nullptr && _def->_is_active;
202 get_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 void resume_after_pause()
Resumes the PStatClient after the simulation has been paused for a while.
static void disconnect()
Closes the connection previously established.
PT(Thread) PStatClient
Returns the Panda Thread object associated with the indicated PStatThread.
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.