29
29
def profile(f, *args, **kwds):
30
30
"""Run a function profile.
32
36
:return: The functions return value and a stats object.
37
41
threading.setprofile(_thread_profile)
51
46
for pp in _g_threadmap.values():
53
48
threading.setprofile(None)
56
51
for tid, pp in _g_threadmap.items():
57
52
threads[tid] = Stats(pp.getstats(), {})