Explorar el Código

Use cProfile if available (Python 2.5 and later)

Mike Naberezny hace 13 años
padre
commit
dd94347aff
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      supervisor/supervisord.py

+ 5 - 2
supervisor/supervisord.py

@@ -313,7 +313,7 @@ class Supervisor:
             else:
                 self.options.logger.blather(
                     'received %s indicating nothing' % signame(sig))
-        
+
     def get_state(self):
         return self.options.mood
 
@@ -322,7 +322,10 @@ def timeslice(period, when):
 
 # profile entry point
 def profile(cmd, globals, locals, sort_order, callers):
-    import profile
+    try:
+        import cProfile as profile
+    except ImportError:
+        import profile # python < 2.5
     import pstats
     import tempfile
     fd, fn = tempfile.mkstemp()