Permalink
Browse files

handle demangled C++ functions better

  • Loading branch information...
1 parent d03cc99 commit 65000d791c7873a2de2a5977926d8afdd3a6a7ef @davepacheco committed Mar 1, 2012
Showing with 5 additions and 0 deletions.
  1. +3 −0 flamegraph.pl
  2. +2 −0 stackcollapse.pl
View
@@ -240,6 +240,9 @@ sub flow {
$info = "all samples ($samples samples, 100%)";
} else {
my $pct = sprintf "%.2f", ((100 * $samples) / $timemax);
+ $func =~ s/&/&/g;
+ $func =~ s/</&lt;/g;
+ $func =~ s/>/&gt;/g;
$info = "$func ($samples samples, $pct%)";
}
$im->filledRectangle($x1, $y1, $x2, $y2, color("hot"), 'rx="2" ry="2" onmouseover="s(' . "'$info'" . ')" onmouseout="c()"');
View
@@ -76,6 +76,8 @@ sub remember_stack {
my $frame = $_;
$frame =~ s/^\s*//;
$frame =~ s/\+.*$//;
+ # Remove arguments from C++ function names.
+ $frame =~ s/(..)[(<].*/$1/;
$frame = "-" if $frame eq "";
unshift @stack, $frame;
}

0 comments on commit 65000d7

Please sign in to comment.