commit 4952f8786cb655cc2ced8efa72636cab296a09d5
parent b346b810781b0944cd02d436e770632e30ba9439
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Wed, 3 Apr 2013 09:01:35 -0700
Merge pull request #18 from timbunce/factor2
Add --factor option to scale the presented values.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/flamegraph.pl b/flamegraph.pl
@@ -66,6 +66,7 @@ my $nametype = "Function:"; # what are the names in the data?
my $countname = "samples"; # what are the counts in the data?
my $nameattrfile; # file holding function attributes
my $timemax; # (override the) sum of the counts
+my $factor = 1; # factor to scale counts by
GetOptions(
'fonttype=s' => \$fonttype,
@@ -78,6 +79,7 @@ GetOptions(
'countname=s' => \$countname,
'nameattr=s' => \$nameattrfile,
'total=s' => \$timemax,
+ 'factor=f' => \$factor,
) or exit 1;
@@ -246,7 +248,8 @@ warn "Ignored $ignored lines with invalid format\n" if $ignored;
die "ERROR: No stack counts found\n" unless $time;
if ($timemax and $timemax < $time) {
- warn "Specified --total $timemax is less than actual total $time, so ignored\n";
+ warn "Specified --total $timemax is less than actual total $time, so ignored\n"
+ if $timemax/$time > 0.02; # only warn is significant (e.g., not rounding etc)
undef $timemax;
}
$timemax ||= $time;
@@ -314,7 +317,7 @@ while (my ($id, $node) = each %Node) {
my $y1 = $imageheight - $ypad2 - ($depth + 1) * $frameheight + 1;
my $y2 = $imageheight - $ypad2 - $depth * $frameheight;
- my $samples = sprintf "%.0f", $etime - $stime;
+ my $samples = sprintf "%.0f", ($etime - $stime) * $factor;
(my $samples_txt = $samples) # add commas per perlfaq5
=~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;