Add option to show total time including children in flat profiles
Adds a literal string argument flat_time to ConsoleRenderer which can be used to set frame time type displayed (and used as sort key) in flat profiles - "self" for total self time, excluding child frames (the default, equivalent to current behaviour) and "total" for total time, including child frames.
I find being able to view a flat list sorted by total time useful in some situations, but it does result in the less intutitive behaviour that the sum of the times shown no longer bears any relation to total run time.
Rather than a string argument could alternatively use a boolean flag if preferred or change name of options.
For the remaining pyright error in pre-commit workflow, I get the same error when running pre-commit run --all-files locally on current tip of main so not sure if the failure is related to changes in this PR or a change in upstream packages?
Could you add the option to
Profiler.printandProfiler.output_text, too?
flat_time option now also exposed in Profiler.print and Profiler.output_text. I created a type alias FlatTimeMode to avoid repetition of the allowable string modes in the type hint and this seemed to mirror the pattern used for AsyncMode in profiler.py but let me know if you prefer this to be named differently.