Browse Source

track number of cyclers in PStats

David Rose 20 years ago
parent
commit
0a0377607d

+ 7 - 0
panda/src/display/graphicsEngine.cxx

@@ -59,6 +59,8 @@ PStatCollector GraphicsEngine::_transform_states_pcollector("TransformStates");
 PStatCollector GraphicsEngine::_transform_states_unused_pcollector("TransformStates:Unused");
 PStatCollector GraphicsEngine::_render_states_pcollector("RenderStates");
 PStatCollector GraphicsEngine::_render_states_unused_pcollector("RenderStates:Unused");
+PStatCollector GraphicsEngine::_cyclers_pcollector("PipelineCyclers");
+PStatCollector GraphicsEngine::_dirty_cyclers_pcollector("PipelineCyclers:Dirty");
 
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsEngine::Constructor
@@ -537,6 +539,11 @@ render_frame() {
     }
   }
 
+#if defined(DO_PIPELINING) && defined(HAVE_THREADS)
+  _cyclers_pcollector.set_level(_pipeline->get_num_cyclers());
+  _dirty_cyclers_pcollector.set_level(_pipeline->get_num_dirty_cyclers());
+#endif  // DO_PIPELINING && HAVE_THREADS
+
   // Now cycle the pipeline and officially begin the next frame.
   {
     PStatTimer timer(_cycle_pcollector);

+ 2 - 0
panda/src/display/graphicsEngine.h

@@ -259,6 +259,8 @@ private:
   static PStatCollector _transform_states_unused_pcollector;
   static PStatCollector _render_states_pcollector;
   static PStatCollector _render_states_unused_pcollector;
+  static PStatCollector _cyclers_pcollector;
+  static PStatCollector _dirty_cyclers_pcollector;
 
   friend class WindowRenderer;
   friend class GraphicsOutput;

+ 2 - 0
panda/src/pstatclient/pStatProperties.cxx

@@ -211,6 +211,8 @@ static LevelCollectorProperties level_properties[] = {
   { 1, "RenderStates:On nodes",            { 0.2, 0.8, 1.0 } },
   { 1, "RenderStates:Cached",              { 1.0, 0.0, 0.2 } },
   { 1, "RenderStates:Unused",              { 0.2, 0.2, 0.2 } },
+  { 1, "PipelineCyclers",                  { 0.5, 0.5, 1.0 },  "", 5000 },
+  { 1, "PipelineCyclers:Dirty",            { 0.2, 0.2, 0.2 } },
   { 0, NULL }
 };
 

+ 31 - 0
panda/src/putil/pipeline.I

@@ -51,3 +51,34 @@ INLINE int Pipeline::
 get_num_stages() const {
   return _num_stages;
 }
+
+#if defined(DO_PIPELINING) && defined(HAVE_THREADS)
+////////////////////////////////////////////////////////////////////
+//     Function: Pipeline::get_num_cyclers
+//       Access: Public
+//  Description: Returns the number of PipelineCyclers in the universe
+//               that reference this Pipeline object.
+////////////////////////////////////////////////////////////////////
+INLINE int Pipeline::
+get_num_cyclers() const {
+  ReMutexHolder holder(_lock);
+  return _cyclers.size();
+}
+#endif  // DO_PIPELINING && HAVE_THREADS
+
+#if defined(DO_PIPELINING) && defined(HAVE_THREADS)
+////////////////////////////////////////////////////////////////////
+//     Function: Pipeline::get_num_dirty_cyclers
+//       Access: Public
+//  Description: Returns the number of PipelineCyclers in the universe
+//               that reference this Pipeline object and are currently
+//               marked "dirty"; that is, there is a difference in
+//               pointer value between some of their stages.
+////////////////////////////////////////////////////////////////////
+INLINE int Pipeline::
+get_num_dirty_cyclers() const {
+  ReMutexHolder holder(_lock);
+  return _dirty_cyclers.size();
+}
+#endif  // DO_PIPELINING && HAVE_THREADS
+

+ 3 - 0
panda/src/putil/pipeline.h

@@ -56,6 +56,9 @@ public:
   void add_cycler(PipelineCyclerTrueImpl *cycler);
   void add_dirty_cycler(PipelineCyclerTrueImpl *cycler);
   void remove_cycler(PipelineCyclerTrueImpl *cycler);
+
+  INLINE int get_num_cyclers() const;
+  INLINE int get_num_dirty_cyclers() const;
 #endif  // DO_PIPELINING && HAVE_THREADS
 
 private: