diff --git a/panda/src/pstatclient/pStatCollector.I b/panda/src/pstatclient/pStatCollector.I index 300b1e2c43..c6c7f99c46 100644 --- a/panda/src/pstatclient/pStatCollector.I +++ b/panda/src/pstatclient/pStatCollector.I @@ -149,6 +149,46 @@ is_valid() const { return (_client != (PStatClient *)NULL); } +//////////////////////////////////////////////////////////////////// +// Function: PStatCollector::get_name +// Access: Published +// Description: Returns the local name of this collector. This is +// the rightmost part of the fullname, after the +// rightmost colon. +//////////////////////////////////////////////////////////////////// +INLINE string PStatCollector:: +get_name() const { + if (_client != (PStatClient *)NULL) { + return _client->get_collector_name(_index); + } + return string(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PStatCollector::get_fullname +// Access: Published +// Description: Returns the full name of this collector. This +// includes the names of all the collector's parents, +// concatenated together with colons. +//////////////////////////////////////////////////////////////////// +INLINE string PStatCollector:: +get_fullname() const { + if (_client != (PStatClient *)NULL) { + return _client->get_collector_fullname(_index); + } + return string(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PStatCollector::output +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void PStatCollector:: +output(ostream &out) const { + out << "PStatCollector(\"" << get_fullname() << "\")"; +} + //////////////////////////////////////////////////////////////////// // Function: PStatCollector::is_active // Access: Published diff --git a/panda/src/pstatclient/pStatCollector.h b/panda/src/pstatclient/pStatCollector.h index 5ecde7a410..2161d15ac1 100644 --- a/panda/src/pstatclient/pStatCollector.h +++ b/panda/src/pstatclient/pStatCollector.h @@ -69,6 +69,9 @@ PUBLISHED: INLINE void operator = (const PStatCollector ©); INLINE bool is_valid() const; + INLINE string get_name() const; + INLINE string get_fullname() const; + INLINE void output(ostream &out) const; INLINE bool is_active(); INLINE bool is_started(); @@ -152,5 +155,12 @@ PUBLISHED: #include "pStatCollector.I" +inline ostream &operator << (ostream &out, const PStatCollector &pcol) { +#ifdef DO_PSTATS + pcol.output(out); +#endif // DO_PSTATS + return out; +} + #endif