debug.profile: support kwargs and ret values

This commit is contained in:
Vassilii Khachaturov 2014-02-16 13:52:05 +02:00
parent 6c2d18f807
commit ad812c8537

View File

@ -33,12 +33,12 @@ from __future__ import print_function
# Debugging utilities # Debugging utilities
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def profile(func, *args): def profile(func, *args, **kwargs):
import hotshot.stats import hotshot.stats
prf = hotshot.Profile('mystats.profile') prf = hotshot.Profile('mystats.profile')
print("Start") print("Start")
prf.runcall(func, *args) r = prf.runcall(func, *args, **kwargs)
print("Finished") print("Finished")
prf.close() prf.close()
print("Loading profile") print("Loading profile")
@ -48,6 +48,7 @@ def profile(func, *args):
stats.sort_stats('time', 'calls') stats.sort_stats('time', 'calls')
stats.print_stats(100) stats.print_stats(100)
stats.print_callers(100) stats.print_callers(100)
return r
def format_exception(tb_type=None, tb_value=None, tb=None): def format_exception(tb_type=None, tb_value=None, tb=None):
""" """