How to calculate the average result of several cProfile results?
问题 Instead of only running the profile one time like this: import cProfile def do_heavy_lifting(): for i in range(100): print('hello') profiller = cProfile.Profile() profiller.enable() do_heavy_lifting() profiller.disable() profiller.print_stats(sort='time') Where the profile results are like this: 502 function calls in 0.000 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 100 0.000 0.000 0.000 0.000 {built-in method builtins.print} 200 0.000 0