Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #18 from timbunce/factor2

Add --factor option to scale the presented values.
  • Loading branch information...
commit 4952f8786cb655cc2ced8efa72636cab296a09d5 2 parents b346b81 + 489672a
@brendangregg authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 flamegraph.pl
View
7 flamegraph.pl
@@ -66,6 +66,7 @@
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 @@
'countname=s' => \$countname,
'nameattr=s' => \$nameattrfile,
'total=s' => \$timemax,
+ 'factor=f' => \$factor,
) or exit 1;
@@ -246,7 +248,8 @@ sub flow {
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 @@ sub flow {
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;
Please sign in to comment.
Something went wrong with that request. Please try again.