Просмотр исходного кода

everything outside of GraphicsEngine::render_frame() is deemed Show Code for pstats

David Rose 22 лет назад
Родитель
Сommit
82385a51d0
2 измененных файлов с 16 добавлено и 0 удалено
  1. 15 0
      panda/src/display/graphicsEngine.cxx
  2. 1 0
      panda/src/display/graphicsEngine.h

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

@@ -39,6 +39,7 @@
 #endif
 #endif
 
 
 #ifndef CPPPARSER
 #ifndef CPPPARSER
+PStatCollector GraphicsEngine::_show_code_pcollector("App:Show Code");
 PStatCollector GraphicsEngine::_cull_pcollector("Cull");
 PStatCollector GraphicsEngine::_cull_pcollector("Cull");
 PStatCollector GraphicsEngine::_draw_pcollector("Draw");
 PStatCollector GraphicsEngine::_draw_pcollector("Draw");
 PStatCollector GraphicsEngine::_sync_pcollector("Draw:Sync");
 PStatCollector GraphicsEngine::_sync_pcollector("Draw:Sync");
@@ -90,6 +91,10 @@ GraphicsEngine(Pipeline *pipeline) :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 GraphicsEngine::
 GraphicsEngine::
 ~GraphicsEngine() {
 ~GraphicsEngine() {
+  if (_show_code_pcollector.is_active()) {
+    _show_code_pcollector.stop();
+  }
+
   remove_all_windows();
   remove_all_windows();
 }
 }
 
 
@@ -341,6 +346,12 @@ is_empty() const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void GraphicsEngine::
 void GraphicsEngine::
 render_frame() {
 render_frame() {
+  // Anything that happens outside of GraphicsEngine::render_frame()
+  // is deemed to be show code.
+  if (_show_code_pcollector.is_active()) {
+    _show_code_pcollector.stop();
+  }
+
   // We hold the GraphicsEngine mutex while we wait for all of the
   // We hold the GraphicsEngine mutex while we wait for all of the
   // threads.  Doing this puts us at risk for deadlock if any of the
   // threads.  Doing this puts us at risk for deadlock if any of the
   // threads tries to call any methods on the GraphicsEngine.  So
   // threads tries to call any methods on the GraphicsEngine.  So
@@ -403,6 +414,10 @@ render_frame() {
     tv.tv_usec = 0;
     tv.tv_usec = 0;
     select(0, NULL, NULL, NULL, &tv);
     select(0, NULL, NULL, NULL, &tv);
   }
   }
+
+  // Anything that happens outside of GraphicsEngine::render_frame()
+  // is deemed to be show code.
+  _show_code_pcollector.start();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

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

@@ -192,6 +192,7 @@ private:
   FlipState _flip_state;
   FlipState _flip_state;
   Mutex _lock;
   Mutex _lock;
 
 
+  static PStatCollector _show_code_pcollector;
   static PStatCollector _cull_pcollector;
   static PStatCollector _cull_pcollector;
   static PStatCollector _draw_pcollector;
   static PStatCollector _draw_pcollector;
   static PStatCollector _sync_pcollector;
   static PStatCollector _sync_pcollector;