David Rose 24 лет назад
Родитель
Сommit
1804939a70

+ 2 - 1
panda/src/pstatclient/pStatClient.cxx

@@ -253,7 +253,8 @@ make_collector_with_relname(int parent_index, string relname) {
       make_collector_with_name(parent_index, parent_name);
     parent_index = parent_collector._index;
     relname = relname.substr(colon + 1);
-    colon = relname.find(':', start);
+    start = 0;
+    colon = relname.find(':');
   }
 
   string name = relname.substr(start);

+ 6 - 0
panda/src/pstatclient/pStatClient.h

@@ -198,6 +198,12 @@ public:
   PStatClient() { }
   ~PStatClient() { }
 
+PUBLISHED:
+  INLINE static bool connect(const string & = string(), int = -1) { return false; }
+  INLINE static void disconnect() { }
+  INLINE static bool is_connected() { return false; }
+
+public:
   static void main_tick() { }
 };
 

+ 80 - 80
panda/src/pstatclient/pStatCollector.I

@@ -46,7 +46,7 @@ PStatCollector(PStatClient *client, int index) :
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::Constructor
-//       Access: Public
+//       Access: Published
 //  Description: Creates a new PStatCollector, ready to start
 //               accumulating data.  The name of the collector
 //               uniquely identifies it among the other collectors; if
@@ -74,7 +74,7 @@ PStatCollector(const string &name, PStatClient *client) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::Constructor
-//       Access: Public
+//       Access: Published
 //  Description: Creates a new PStatCollector, ready to start
 //               accumulating data.  The name of the collector
 //               uniquely identifies it among the other collectors; if
@@ -104,7 +104,7 @@ PStatCollector(const PStatCollector &parent, const string &name) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::Copy Constructor
-//       Access: Public
+//       Access: Published
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE PStatCollector::
@@ -116,7 +116,7 @@ PStatCollector(const PStatCollector &copy) :
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::Copy Assignment Operator
-//       Access: Public
+//       Access: Published
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE void PStatCollector::
@@ -127,7 +127,7 @@ operator = (const PStatCollector &copy) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::is_active
-//       Access: Public
+//       Access: Published
 //  Description: Returns true if this particular collector is active
 //               on the default thread, and we are currently
 //               transmitting PStats data.
@@ -137,6 +137,81 @@ is_active() {
   return _client->is_active(_index, 0);
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::start
+//       Access: Published
+//  Description: Starts this particular timer ticking.  This should be
+//               called before the code you want to measure.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+start() {
+  _client->start(_index, 0, _client->_clock.get_real_time());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::stop
+//       Access: Published
+//  Description: Stops this timer.  This should be called after the
+//               code you want to measure.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+stop() {
+  _client->stop(_index, 0, _client->_clock.get_real_time());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::clear_level
+//       Access: Published
+//  Description: Removes the level setting associated with this
+//               collector for the main thread.  The collector
+//               will no longer show up on any level graphs in the
+//               main thread.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+clear_level() {
+  _client->clear_level(_index, 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::set_level
+//       Access: Published
+//  Description: Sets the level setting associated with this
+//               collector for the main thread to the indicated
+//               value.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+set_level(float level) {
+  _client->set_level(_index, 0, level);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::add_level
+//       Access: Published
+//  Description: Adds the indicated increment (which may be negative)
+//               to the level setting associated with this collector
+//               for the main thread.  If the collector did not
+//               already have a level setting for the main thread, it
+//               is initialized to 0.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+add_level(float increment) {
+  _client->add_level(_index, 0, increment);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PStatCollector::sub_level
+//       Access: Published
+//  Description: Subtracts the indicated decrement (which may be
+//               negative) to the level setting associated with this
+//               collector for the main thread.  If the collector did
+//               not already have a level setting for the main thread,
+//               it is initialized to 0.
+////////////////////////////////////////////////////////////////////
+INLINE void PStatCollector::
+sub_level(float decrement) {
+  _client->add_level(_index, 0, -decrement);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::is_active
 //       Access: Public
@@ -149,17 +224,6 @@ is_active(const PStatThread &thread) {
   return _client->is_active(_index, thread._index);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::start
-//       Access: Public
-//  Description: Starts this particular timer ticking.  This should be
-//               called before the code you want to measure.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-start() {
-  _client->start(_index, 0, _client->_clock.get_real_time());
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::start
 //       Access: Public
@@ -184,17 +248,6 @@ start(const PStatThread &thread, float as_of) {
   _client->start(_index, thread._index, as_of);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::stop
-//       Access: Public
-//  Description: Stops this timer.  This should be called after the
-//               code you want to measure.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-stop() {
-  _client->stop(_index, 0, _client->_clock.get_real_time());
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::stop
 //       Access: Public
@@ -219,19 +272,6 @@ stop(const PStatThread &thread, float as_of) {
   _client->stop(_index, thread._index, as_of);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::clear_level
-//       Access: Public
-//  Description: Removes the level setting associated with this
-//               collector for the main thread.  The collector
-//               will no longer show up on any level graphs in the
-//               main thread.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-clear_level() {
-  _client->clear_level(_index, 0);
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::clear_level
 //       Access: Public
@@ -245,18 +285,6 @@ clear_level(const PStatThread &thread) {
   _client->clear_level(_index, thread._index);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::set_level
-//       Access: Public
-//  Description: Sets the level setting associated with this
-//               collector for the main thread to the indicated
-//               value.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-set_level(float level) {
-  _client->set_level(_index, 0, level);
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::set_level
 //       Access: Public
@@ -269,20 +297,6 @@ set_level(const PStatThread &thread, float level) {
   _client->set_level(_index, thread._index, level);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::add_level
-//       Access: Public
-//  Description: Adds the indicated increment (which may be negative)
-//               to the level setting associated with this collector
-//               for the main thread.  If the collector did not
-//               already have a level setting for the main thread, it
-//               is initialized to 0.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-add_level(float increment) {
-  _client->add_level(_index, 0, increment);
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::add_level
 //       Access: Public
@@ -297,20 +311,6 @@ add_level(const PStatThread &thread, float increment) {
   _client->add_level(_index, thread._index, increment);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: PStatCollector::sub_level
-//       Access: Public
-//  Description: Subtracts the indicated decrement (which may be
-//               negative) to the level setting associated with this
-//               collector for the main thread.  If the collector did
-//               not already have a level setting for the main thread,
-//               it is initialized to 0.
-////////////////////////////////////////////////////////////////////
-INLINE void PStatCollector::
-sub_level(float decrement) {
-  _client->add_level(_index, 0, -decrement);
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: PStatCollector::sub_level
 //       Access: Public

+ 22 - 22
panda/src/pstatclient/pStatCollector.h

@@ -57,7 +57,7 @@ private:
   INLINE PStatCollector();
   INLINE PStatCollector(PStatClient *client, int index);
 
-public:
+PUBLISHED:
   INLINE PStatCollector(const string &name,
                         PStatClient *client = NULL);
   INLINE PStatCollector(const PStatCollector &parent,
@@ -67,23 +67,24 @@ public:
   INLINE void operator = (const PStatCollector &copy);
 
   INLINE bool is_active();
-  INLINE bool is_active(const PStatThread &thread);
-
   INLINE void start();
+  INLINE void stop();
+
+  INLINE void clear_level();
+  INLINE void set_level(float level);
+  INLINE void add_level(float increment);
+  INLINE void sub_level(float decrement);
+
+public:
+  INLINE bool is_active(const PStatThread &thread);
   INLINE void start(const PStatThread &thread);
   INLINE void start(const PStatThread &thread, float as_of);
-
-  INLINE void stop();
   INLINE void stop(const PStatThread &thread);
   INLINE void stop(const PStatThread &thread, float as_of);
 
-  INLINE void clear_level();
   INLINE void clear_level(const PStatThread &thread);
-  INLINE void set_level(float level);
   INLINE void set_level(const PStatThread &thread, float level);
-  INLINE void add_level(float increment);
   INLINE void add_level(const PStatThread &thread, float increment);
-  INLINE void sub_level(float decrement);
   INLINE void sub_level(const PStatThread &thread, float decrement);
 
 private:
@@ -93,33 +94,32 @@ private:
 friend class PStatClient;
 
 #else  // DO_PSTATS
-public:
+PUBLISHED:
   INLINE PStatCollector(const string &,
-                        const RGBColorf & = RGBColorf::zero(),
-                        int = -1,
                         PStatClient * = NULL) { }
   INLINE PStatCollector(const PStatCollector &,
-                        const string &,
-                        const RGBColorf & = RGBColorf::zero(),
-                        int = -1) { }
+                        const string &) { }
 
   INLINE bool is_active() { return false; }
-  INLINE bool is_active(const PStatThread &) { return false; }
-
   INLINE void start() { }
+  INLINE void stop() { }
+
+  INLINE void clear_level() { }
+  INLINE void set_level(float) { }
+  INLINE void add_level(float) { }
+  INLINE void sub_level(float) { }
+
+public:
+  INLINE bool is_active(const PStatThread &) { return false; }
   INLINE void start(const PStatThread &) { }
   INLINE void start(const PStatThread &, float) { }
-
-  INLINE void stop() { }
   INLINE void stop(const PStatThread &) { }
   INLINE void stop(const PStatThread &, float) { }
 
-  INLINE void clear_level() { }
   INLINE void clear_level(const PStatThread &) { }
-  INLINE void set_level(float) { }
   INLINE void set_level(const PStatThread &, float) { }
-  INLINE void add_level(float) { }
   INLINE void add_level(const PStatThread &, float) { }
+  INLINE void sub_level(const PStatThread &, float) { }
 
 #endif  // DO_PSTATS
 };