flamegraph

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

commit 044f09b9d5f4f65c83b55b87c574c618aaadc237
parent 921d598bf5811c36f1f17b31d15b07e19cd40d6f
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date:   Sun, 12 Jul 2015 15:59:04 -0700

add --help option, URLs, and update major history

Diffstat:
Mflamegraph.pl | 52+++++++++++++++++++++++++++++++---------------------
1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/flamegraph.pl b/flamegraph.pl @@ -66,6 +66,7 @@ # # CDDL HEADER END # +# 11-Oct-2014 Adrien Mahieux Added zoom. # 21-Nov-2013 Shawn Sterling Added consistent palette file option # 17-Mar-2013 Tim Bunce Added options and more tunables. # 15-Dec-2011 Dave Pacheco Support for frames with whitespace. @@ -101,28 +102,10 @@ my $negate = 0; # switch differential hues my $titletext = ""; # centered heading my $titledefault = "Flame Graph"; # overwritten by --title my $titleinverted = "Icicle Graph"; # " " +my $help = 0; -GetOptions( - 'fonttype=s' => \$fonttype, - 'width=i' => \$imagewidth, - 'height=i' => \$frameheight, - 'encoding=s' => \$encoding, - 'fontsize=f' => \$fontsize, - 'fontwidth=f' => \$fontwidth, - 'minwidth=f' => \$minwidth, - 'title=s' => \$titletext, - 'nametype=s' => \$nametype, - 'countname=s' => \$countname, - 'nameattr=s' => \$nameattrfile, - 'total=s' => \$timemax, - 'factor=f' => \$factor, - 'colors=s' => \$colors, - 'hash' => \$hash, - 'cp' => \$palette, - 'reverse' => \$stackreverse, - 'inverted' => \$inverted, - 'negate' => \$negate, -) or die <<USAGE_END; +sub usage { + die <<USAGE_END; USAGE: $0 [options] infile > outfile.svg\n --title # change title text --width # width of image (default 1200) @@ -139,10 +122,36 @@ USAGE: $0 [options] infile > outfile.svg\n --reverse # generate stack-reversed flame graph --inverted # icicle graph --negate # switch differential hues (blue<->red) + --help # this message eg, $0 --title="Flame Graph: malloc()" trace.txt > graph.svg USAGE_END +} + +GetOptions( + 'fonttype=s' => \$fonttype, + 'width=i' => \$imagewidth, + 'height=i' => \$frameheight, + 'encoding=s' => \$encoding, + 'fontsize=f' => \$fontsize, + 'fontwidth=f' => \$fontwidth, + 'minwidth=f' => \$minwidth, + 'title=s' => \$titletext, + 'nametype=s' => \$nametype, + 'countname=s' => \$countname, + 'nameattr=s' => \$nameattrfile, + 'total=s' => \$timemax, + 'factor=f' => \$factor, + 'colors=s' => \$colors, + 'hash' => \$hash, + 'cp' => \$palette, + 'reverse' => \$stackreverse, + 'inverted' => \$inverted, + 'negate' => \$negate, + 'help' => \$help, +) or usage(); +$help && usage(); # internals my $ypad1 = $fontsize * 4; # pad top, include title @@ -195,6 +204,7 @@ if ($colors eq "io") { $bgcolor1 = "#f8f8f8"; $bgcolor2 = "#e8e8e8"; } <?xml version="1.0"$enc_attr standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" width="$w" height="$h" onload="init(evt)" viewBox="0 0 $w $h" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<!-- Flame graph stack visualization. See https://github.com/brendangregg/FlameGraph for latest version, and http://www.brendangregg.com/flamegraphs.html for examples. --> SVG }