Python 2.4.1 (#65, Jul 8 2005, 00:45:44) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def func(): ... print 'o hai' ... >>> import gc >>> gc.set_debug(gc.DEBUG_LEAK) >>> import profile >>> profile.run('func()') o hai 4 function calls in 0.002 CPU seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.002 0.002 0.002 0.002 :0(setprofile) 1 0.000 0.000 0.000 0.000 :1(func) 1 0.000 0.000 0.000 0.000 :1(?) 1 0.000 0.000 0.002 0.002 profile:0(func()) 0 0.000 0.000 profile:0(profiler) >>> gc.collect() 25 gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable >>> gc.garbage [{'stats': {}, 'cur': (0, 0, 0.0024751687500000003, ('profile', 0, 'profiler'), , None), 'cmd': 'func()', 'timer': , 't': 0.0026175037499999998, 'bias': 0, 'timings': {('profile', 0, 'func()'): (1, -1, 7.6901250000000019e-005, 0.0024751687500000003, {('profile', 0, 'profiler'): 1}), ('', 1, '?'): (1, -1, 5.373749999999989e-006, 2.9939999999999974e-005, {('profile', 0, 'func()'): 1}), ('profile', 0, 'profiler'): (0, 0, 0, 0, {}), ('', 1, 'func'): (1, -1, 2.4566249999999985e-005, 2.4566249999999985e-005, {('', 1, '?'): 1}), ('', 0, 'setprofile'): (1, -1, 0.0023683275000000001, 0.0023683275000000001, {('profile', 0, 'func()'): 1})}, 'get_time': , 'dispatcher': >, 'c_func_name': 'setprofile'}, , {('profile', 0, 'func()'): (1, -1, 7.6901250000000019e-005, 0.0024751687500000003, {('profile', 0, 'profiler'): 1}), ('', 1, '?'): (1, -1, 5.373749999999989e-006, 2.9939999999999974e-005, {('profile', 0, 'func()'): 1}), ('profile', 0, 'profiler'): (0, 0, 0, 0, {}), ('', 1, 'func'): (1, -1, 2.4566249999999985e-005, 2.4566249999999985e-005, {('', 1, '?'): 1}), ('', 0, 'setprofile'): (1, -1, 0.0023683275000000001, 0.0023683275000000001, {('profile', 0, 'func()'): 1})}, >, {'co_line': 0, 'co_name': 'profiler', 'co_firstlineno': 0, 'co_filename': 'profile'}, ('profile', 0, 'profiler'), {'f_code': ('profile', 0, 'profiler'), 'f_back': None}, , ('profile', 0, 'profiler'), {}, (0, 0, 0, 0, {}), ('profile', 0, 'func()'), {('profile', 0, 'profiler'): 1}, ('', 1, '?'), {('profile', 0, 'func()'): 1}, ('', 1, 'func'), {('', 1, '?'): 1}, (1, -1, 2.4566249999999985e-005, 2.4566249999999985e-005, {('', 1, '?'): 1}), (1, -1, 5.373749999999989e-006, 2.9939999999999974e-005, {('profile', 0, 'func()'): 1}), ('', 0, 'setprofile'), {('profile', 0, 'func()'): 1}, (1, -1, 0.0023683275000000001, 0.0023683275000000001, {('profile', 0, 'func()'): 1}), (0, 0, 0.0024751687500000003, ('profile', 0, 'profiler'), , None), (1, -1, 7.6901250000000019e-005, 0.0024751687500000003, {('profile', 0, 'profiler'): 1}), {}] >>>