pyinstrument
pyinstrument copied to clipboard
Include percentages of parent in the report
It would be useful if the report showed the percentage of the time spent relative to the other frames with the same parent in addition to the absolute time.
I looked at the code, and the frame objects do not seem to reference their parents, only their children, so this isn't so easy to add as a simple method on the frame object without introducing the circular reference (not sure if that's OK to do).
Hi @asmeurer ! I'm not sure how we'd incorporate visually into the output, but it should be easy enough to write a renderer to do it - the Frame objects do reference their parent and there's already a property : https://github.com/joerick/pyinstrument/blob/master/pyinstrument/frame.py#L21 that gives a number between 0 and 1 indicating the fraction of parent time.
Percentage time was added in v4.3.0, although this is relative to the total, not the parent.