Skip to content

Commit

Permalink
add --help option, URLs, and update major history
Browse files Browse the repository at this point in the history
  • Loading branch information
brendangregg committed Jul 12, 2015
1 parent 921d598 commit 044f09b
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions flamegraph.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -101,28 +102,10 @@
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)
Expand All @@ -139,10 +122,36 @@
--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
Expand Down Expand Up @@ -195,6 +204,7 @@
<?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
}

Expand Down

0 comments on commit 044f09b

Please sign in to comment.