Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

handle C++ function names better #3

Merged
merged 1 commit into from

2 participants

@davepacheco

This change does two things:

  • Escapes XML meta-characters while emitting the SVG. You need this because C++ function names can have an "&".
  • Removes function and template arguments, as long as they're not one of the first two characters of the function name. This exception exists because the Node ustack helper emits lines with "<<" and "((" prefixes.
@brendangregg brendangregg merged commit 213de61 into brendangregg:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2012
  1. @davepacheco
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +3 −0  flamegraph.pl
  2. +2 −0  stackcollapse.pl
View
3  flamegraph.pl
@@ -240,6 +240,9 @@ sub flow {
$info = "all samples ($samples samples, 100%)";
} else {
my $pct = sprintf "%.2f", ((100 * $samples) / $timemax);
+ $func =~ s/&/&amp;/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
2  stackcollapse.pl
@@ -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;
}
Something went wrong with that request. Please try again.