Sfoglia il codice sorgente

moved PStat import to top of file for more efficient profiling

Joe Shochet 20 anni fa
parent
commit
88d05089fe
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      direct/src/task/Task.py

+ 4 - 1
direct/src/task/Task.py

@@ -16,6 +16,10 @@ import string
 import signal
 from libheapq import heappush, heappop, heapify
 
+if __debug__:
+    # For pstats
+    from pandac.PandaModules import PStatCollector
+
 # MRM: Need to make internal task variables like time, name, index
 # more unique (less likely to have name clashes)
 
@@ -138,7 +142,6 @@ class Task:
 
     def setupPStats(self, name):
         if __debug__ and TaskManager.taskTimerVerbose:
-            from pandac.PandaModules import PStatCollector
             self.pstats = PStatCollector("App:Show code:" + name)
 
     def finishTask(self, verbose):