commit 4ba8154a1d0649a5028136ce52b2e1ea4e240a32
parent e8c88c24e9442ab18ee9d25083773e4f846b7bce
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Thu, 26 Feb 2015 15:36:06 -0800
Merge pull request #43 from agentzh/diff
flamegraph.pl: fixed the sign of the delta percentage when --negate is specified
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/flamegraph.pl b/flamegraph.pl
@@ -797,8 +797,9 @@ while (my ($id, $node) = each %Node) {
unless (defined $delta) {
$info = "$escaped_func ($samples_txt $countname, $pct%)";
} else {
- my $deltapct = sprintf "%.2f", ((100 * $delta) / ($timemax * $factor));
- $deltapct = $delta > 0 ? "+$deltapct" : $deltapct;
+ my $d = $negate ? -$delta : $delta;
+ my $deltapct = sprintf "%.2f", ((100 * $d) / ($timemax * $factor));
+ $deltapct = $d > 0 ? "+$deltapct" : $deltapct;
$info = "$escaped_func ($samples_txt $countname, $pct%; $deltapct%)";
}
}