Reversed stack ordering
jonhoo opened this issue · 1 comments
We should support the --reverse
option, which, well, reverses the order of all stacks. Note that this does require that we also sort our input, because otherwise the trick we play in flow
in flamegraph/merge.rs
doesn't work!
#96 made a change where we sort input lines by default. I was looking into adding the --reverse
option and it made me aware of something a little weird in our current API. We've added the no_sort
option where you can say your input is already sorted. The problem is, it doesn't make any sense to use this option with from_sorted_lines
since it already expects the lines to be sorted. That's not so bad on its own, but if we add the reverse
option, and our sorting happens in from_reader
and from_readers
, before from_sorted_lines
lines is called, then setting the reverse
flag and calling from_sorted_lines
directly will not reverse the stacks.
I propose we change from_sorted_lines
to simply from_lines
and do the sorting and stack reversing there. The caller can still set the no_sort
flag if the input is already sorted. They can also use the reverse
flag with from_lines
. This way these options make sense no matter which function you call into.