Import cProfile module before falling back to profile

the cProfile/profile modules are great for performance debugging. The
pure-python profile module has much more overhead though and the
cProfile module is recommended if it exists. This changes to import to
first try the cProfile module and then fall back to the profile
module. The cProfile/profiles modules are API compatible for all that
its worth...

If that does not exist we continue to complain as before.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth 2010-12-06 13:19:31 +01:00 committed by Nicolas Sebrecht
parent 325dd833ba
commit 1b32d374b5

View File

@ -157,6 +157,9 @@ class ExitNotifyThread(Thread):
if not profiledir: # normal case
Thread.run(self)
else:
try:
import cProfile as profile
except ImportError:
import profile
prof = profile.Profile()
try: