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:
parent
325dd833ba
commit
1b32d374b5
@ -157,7 +157,10 @@ class ExitNotifyThread(Thread):
|
||||
if not profiledir: # normal case
|
||||
Thread.run(self)
|
||||
else:
|
||||
import profile
|
||||
try:
|
||||
import cProfile as profile
|
||||
except ImportError:
|
||||
import profile
|
||||
prof = profile.Profile()
|
||||
try:
|
||||
prof = prof.runctx("Thread.run(self)", globals(), locals())
|
||||
|
Loading…
Reference in New Issue
Block a user