Browse Source

move a few more PStatCollectors out of local statics

David Rose 14 năm trước cách đây
mục cha
commit
39b32376bb

+ 2 - 2
panda/src/pgraph/nodePath.cxx

@@ -80,6 +80,8 @@
 int NodePath::_max_search_depth = 7000; 
 TypeHandle NodePath::_type_handle;
 
+PStatCollector NodePath::_get_transform_pcollector("*:NodePath:get_transform");
+PStatCollector NodePath::_verify_complete_pcollector("*:NodePath:verify_complete");
 
 #ifdef HAVE_PYTHON
 #include "py_panda.h"  
@@ -1097,7 +1099,6 @@ get_transform(Thread *current_thread) const {
 CPT(TransformState) NodePath::
 get_transform(const NodePath &other, Thread *current_thread) const {
   nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
-  static PStatCollector _get_transform_pcollector("*:NodePath:get_transform");
   PStatTimer timer(_get_transform_pcollector);
 
   if (other.is_empty()) {
@@ -6509,7 +6510,6 @@ verify_complete(Thread *current_thread) const {
   }
 #endif  // HAVE_THREADS
 
-  static PStatCollector _verify_complete_pcollector("*:NodePath:verify_complete");
   PStatTimer timer(_verify_complete_pcollector);
 
   const NodePathComponent *comp = _head;

+ 3 - 0
panda/src/pgraph/nodePath.h

@@ -989,6 +989,9 @@ private:
   ErrorType _error_type;
   static int _max_search_depth;
 
+  static PStatCollector _get_transform_pcollector;
+  static PStatCollector _verify_complete_pcollector;
+
 public:
   static TypeHandle get_class_type() {
     return _type_handle;

+ 2 - 2
panda/src/text/textNode.cxx

@@ -52,7 +52,7 @@
 
 TypeHandle TextNode::_type_handle;
 
-static PStatCollector text_generate_collector("*:Generate Text");
+PStatCollector TextNode::_text_generate_pcollector("*:Generate Text");
 
 ////////////////////////////////////////////////////////////////////
 //     Function: TextNode::Constructor
@@ -343,7 +343,7 @@ write(ostream &out, int indent_level) const {
 ////////////////////////////////////////////////////////////////////
 PT(PandaNode) TextNode::
 generate() {
-  PStatTimer timer(text_generate_collector);
+  PStatTimer timer(_text_generate_pcollector);
   if (text_cat.is_debug()) {
     text_cat.debug()
       << "Rebuilding " << get_type() << " " << get_name()

+ 2 - 0
panda/src/text/textNode.h

@@ -322,6 +322,8 @@ private:
   int _num_rows;
   wstring _wordwrapped_wtext;
 
+  static PStatCollector _text_generate_pcollector;
+
 public:
   static TypeHandle get_class_type() {
     return _type_handle;