Open leod opened 9 years ago
Wait what? ;)
In my case, also, what I care about is total time spent under a node, over all frames, not just the last frame. In fact, I had implicitly assumed this is what the crate does and was surprised at all those "1"s in the call counts.
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.