Bläddra i källkod

Use cProfile if available (Python 2.5 and later)

Mike Naberezny 13 år sedan
förälder
incheckning
dd94347aff
1 ändrade filer med 5 tillägg och 2 borttagningar
  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()