Skip to content

Commit

Permalink
handle demangled C++ functions better
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Pacheco committed Mar 1, 2012
1 parent d03cc99 commit 65000d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flamegraph.pl
Expand Up @@ -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()"');
Expand Down
2 changes: 2 additions & 0 deletions stackcollapse.pl
Expand Up @@ -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;
}
Expand Down

0 comments on commit 65000d7

Please sign in to comment.