commit 213de61401a299eada7b47cce35c898bb5a59e60
parent d03cc99281bd9b22d980e26feb52b05d0e512671
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Thu, 1 Mar 2012 14:18:07 -0800
Merge pull request #3 from davepacheco/master
handle C++ function names better
Diffstat:
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/flamegraph.pl b/flamegraph.pl
@@ -240,6 +240,9 @@ foreach my $id (keys %Node) {
$info = "all samples ($samples samples, 100%)";
} else {
my $pct = sprintf "%.2f", ((100 * $samples) / $timemax);
+ $func =~ s/&/&/g;
+ $func =~ s/</</g;
+ $func =~ s/>/>/g;
$info = "$func ($samples samples, $pct%)";
}
$im->filledRectangle($x1, $y1, $x2, $y2, color("hot"), 'rx="2" ry="2" onmouseover="s(' . "'$info'" . ')" onmouseout="c()"');
diff --git a/stackcollapse.pl b/stackcollapse.pl
@@ -76,6 +76,8 @@ foreach (<>) {
my $frame = $_;
$frame =~ s/^\s*//;
$frame =~ s/\+.*$//;
+ # Remove arguments from C++ function names.
+ $frame =~ s/(..)[(<].*/$1/;
$frame = "-" if $frame eq "";
unshift @stack, $frame;
}