flamegraph

Fork of flamegraph without J***S*****.
git clone git://git.laack.co/flamegraph.git
Log | Files | Refs | README

commit fbb64a8b4291e64c0b96e9bff8443c85f621011f
parent 9d7c1b1233839de1f842135be84e54f2470adb42
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date:   Tue, 16 Oct 2018 15:34:57 -0700

Merge pull request #179 from eregon/flamechart

Add a Flame Chart mode which orders horizontally by time
Diffstat:
Mflamegraph.pl | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/flamegraph.pl b/flamegraph.pl @@ -118,6 +118,7 @@ my %palette_map; # palette map hash my $pal_file = "palette.map"; # palette map file name my $stackreverse = 0; # reverse stack order, switching merge end my $inverted = 0; # icicle graph +my $flamechart = 0; # produce a flame chart (sort by time, do not merge stacks) my $negate = 0; # switch differential hues my $titletext = ""; # centered heading my $titledefault = "Flame Graph"; # overwritten by --title @@ -146,6 +147,7 @@ USAGE: $0 [options] infile > outfile.svg\n --cp # use consistent palette (palette.map) --reverse # generate stack-reversed flame graph --inverted # icicle graph + --flamechart # produce a flame chart (sort by time, do not merge stacks) --negate # switch differential hues (blue<->red) --notes TEXT # add notes comment in SVG (for debugging) --help # this message @@ -175,6 +177,7 @@ GetOptions( 'cp' => \$palette, 'reverse' => \$stackreverse, 'inverted' => \$inverted, + 'flamechart' => \$flamechart, 'negate' => \$negate, 'notes=s' => \$notestext, 'help' => \$help, @@ -191,6 +194,10 @@ my $depthmax = 0; my %Events; my %nameattr; +if ($flamechart && $titletext eq "") { + $titletext = "Flame Chart"; +} + if ($titletext eq "") { unless ($inverted) { $titletext = $titledefault; @@ -564,6 +571,7 @@ sub flow { # parse input my @Data; +my @SortedData; my $last = []; my $time = 0; my $delta = undef; @@ -592,8 +600,15 @@ foreach (<>) { } } +if ($flamechart) { + # In flame chart mode, just reverse the data so time moves from left to right. + @SortedData = reverse @Data; +} else { + @SortedData = sort @Data; +} + # process and merge frames -foreach (sort @Data) { +foreach (@SortedData) { chomp; # process: folded_stack count # eg: func_a;func_b;func_c 31