46 if (client ==
nullptr) {
47 client = PStatClient::get_global_pstats();
49 (*this) = client->make_collector_with_relname(0, name);
72 nassertv(parent._client !=
nullptr);
74 parent._client->make_collector_with_relname(parent._index, name);
82 _client(copy._client),
91 INLINE
void PStatCollector::
93 _client = copy._client;
102 INLINE
bool PStatCollector::
104 return (_client !=
nullptr);
111 INLINE std::string PStatCollector::
113 if (_client !=
nullptr) {
114 return _client->get_collector_name(_index);
116 return std::string();
123 INLINE std::string PStatCollector::
124 get_fullname()
const {
125 if (_client !=
nullptr) {
126 return _client->get_collector_fullname(_index);
128 return std::string();
134 INLINE
void PStatCollector::
135 output(std::ostream &out)
const {
136 out <<
"PStatCollector(\"" << get_fullname() <<
"\")";
143 INLINE
bool PStatCollector::
146 return _client->is_active(_index, 0);
147 #else // HAVE_THREADS 148 return is_active(_client->get_current_thread());
149 #endif // HAVE_THREADS 156 INLINE
bool PStatCollector::
159 return _client->is_started(_index, 0);
160 #else // HAVE_THREADS 161 return is_started(_client->get_current_thread());
162 #endif // HAVE_THREADS 169 INLINE
void PStatCollector::
172 _client->start(_index, 0);
173 #else // HAVE_THREADS 174 start(_client->get_current_thread());
175 #endif // HAVE_THREADS 182 INLINE
void PStatCollector::
185 _client->stop(_index, 0);
186 #else // HAVE_THREADS 187 stop(_client->get_current_thread());
188 #endif // HAVE_THREADS 196 INLINE
void PStatCollector::
198 _client->clear_level(_index, 0);
206 INLINE
void PStatCollector::
207 set_level(
double level) {
208 _client->set_level(_index, 0, level);
221 INLINE
void PStatCollector::
222 add_level(
double increment) {
235 INLINE
void PStatCollector::
236 sub_level(
double decrement) {
243 INLINE
void PStatCollector::
244 add_level_now(
double increment) {
245 add_level(increment);
252 INLINE
void PStatCollector::
253 sub_level_now(
double decrement) {
254 sub_level(decrement);
262 INLINE
void PStatCollector::
264 if (_level != 0.0f) {
265 _client->add_level(_index, 0, _level);
274 INLINE
double PStatCollector::
277 return _client->get_level(_index, 0);
285 INLINE
void PStatCollector::
286 clear_thread_level() {
288 _client->clear_level(_index, 0);
289 #else // HAVE_THREADS 290 clear_level(_client->get_current_thread());
291 #endif // HAVE_THREADS 298 INLINE
void PStatCollector::
299 set_thread_level(
double level) {
301 _client->set_level(_index, 0, level);
302 #else // HAVE_THREADS 303 set_level(_client->get_current_thread(), level);
304 #endif // HAVE_THREADS 313 INLINE
void PStatCollector::
314 add_thread_level(
double increment) {
316 _client->add_level(_index, 0, increment);
317 #else // HAVE_THREADS 318 add_level(_client->get_current_thread(), increment);
319 #endif // HAVE_THREADS 328 INLINE
void PStatCollector::
329 sub_thread_level(
double decrement) {
331 _client->add_level(_index, 0, -decrement);
332 #else // HAVE_THREADS 333 sub_level(_client->get_current_thread(), decrement);
334 #endif // HAVE_THREADS 341 INLINE
double PStatCollector::
344 return _client->get_level(_index, 0);
345 #else // HAVE_THREADS 346 return get_level(_client->get_current_thread());
347 #endif // HAVE_THREADS 354 INLINE
bool PStatCollector::
356 return _client->is_active(_index, thread._index);
363 INLINE
bool PStatCollector::
365 return _client->is_started(_index, thread._index);
371 INLINE
void PStatCollector::
373 nassertv(_client !=
nullptr);
374 _client->start(_index, thread._index);
383 INLINE
void PStatCollector::
385 _client->start(_index, thread._index, as_of);
391 INLINE
void PStatCollector::
393 _client->stop(_index, thread._index);
402 INLINE
void PStatCollector::
404 _client->stop(_index, thread._index, as_of);
412 INLINE
void PStatCollector::
414 _client->clear_level(_index, thread._index);
421 INLINE
void PStatCollector::
422 set_level(
const PStatThread &thread,
double level) {
423 _client->set_level(_index, thread._index, level);
432 INLINE
void PStatCollector::
433 add_level(
const PStatThread &thread,
double increment) {
434 _client->add_level(_index, thread._index, increment);
443 INLINE
void PStatCollector::
444 sub_level(
const PStatThread &thread,
double decrement) {
445 _client->add_level(_index, thread._index, -decrement);
451 INLINE
double PStatCollector::
453 return _client->get_level(_index, thread._index);
460 INLINE
int PStatCollector::
487 if (client ==
nullptr) {
502 if (&parent ==
nullptr) {
A lightweight class that represents a single element that may be timed and/or counted via stats.
A lightweight class that represents a single thread of execution to PStats.
PStatCollector()
Creates an invalid PStatCollector.
Manages the communications to report statistics via a network connection to a remote PStatServer.