From 82385a51d03066f08af5664b0f72c3a6fe61d950 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Feb 2004 16:23:08 +0000 Subject: [PATCH] everything outside of GraphicsEngine::render_frame() is deemed Show Code for pstats --- panda/src/display/graphicsEngine.cxx | 15 +++++++++++++++ panda/src/display/graphicsEngine.h | 1 + 2 files changed, 16 insertions(+) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 3199add0fe..93e012ea21 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -39,6 +39,7 @@ #endif #ifndef CPPPARSER +PStatCollector GraphicsEngine::_show_code_pcollector("App:Show Code"); PStatCollector GraphicsEngine::_cull_pcollector("Cull"); PStatCollector GraphicsEngine::_draw_pcollector("Draw"); PStatCollector GraphicsEngine::_sync_pcollector("Draw:Sync"); @@ -90,6 +91,10 @@ GraphicsEngine(Pipeline *pipeline) : //////////////////////////////////////////////////////////////////// GraphicsEngine:: ~GraphicsEngine() { + if (_show_code_pcollector.is_active()) { + _show_code_pcollector.stop(); + } + remove_all_windows(); } @@ -341,6 +346,12 @@ is_empty() const { //////////////////////////////////////////////////////////////////// void GraphicsEngine:: 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 // threads. Doing this puts us at risk for deadlock if any of the // threads tries to call any methods on the GraphicsEngine. So @@ -403,6 +414,10 @@ render_frame() { tv.tv_usec = 0; select(0, NULL, NULL, NULL, &tv); } + + // Anything that happens outside of GraphicsEngine::render_frame() + // is deemed to be show code. + _show_code_pcollector.start(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index de6f1ff60d..087cecd171 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -192,6 +192,7 @@ private: FlipState _flip_state; Mutex _lock; + static PStatCollector _show_code_pcollector; static PStatCollector _cull_pcollector; static PStatCollector _draw_pcollector; static PStatCollector _sync_pcollector;