As I understand it, the time measurements in hprof are reset at the start of each frame. print_timing() will print the timings of just the last frame.
I think it could be useful to measure timings for a longer duration (e.g. 1 second), optionally. For one thing, this would possibly smooth out random fluctuations in the timings.
Secondly, in my use case, I have some functions that are called periodically (e.g. starting a new game tick 20 times a second), but not necessarily every frame. So in the print_timing() output, I'll get either 0% or the percentage of time in the last frame for these periodical functions. Here, I think it would be useful to instead get the time taken in e.g. the last second.
As I understand it, the time measurements in hprof are reset at the start of each frame.
print_timing()will print the timings of just the last frame.I think it could be useful to measure timings for a longer duration (e.g. 1 second), optionally. For one thing, this would possibly smooth out random fluctuations in the timings.
Secondly, in my use case, I have some functions that are called periodically (e.g. starting a new game tick 20 times a second), but not necessarily every frame. So in the
print_timing()output, I'll get either0%or the percentage of time in the last frame for these periodical functions. Here, I think it would be useful to instead get the time taken in e.g. the last second.