flamegraph

Fork of flamegraph without J***S*****.
git clone git://git.laack.co/flamegraph.git
Log | Files | Refs | README

commit fc4a54568ad0873672b39bc0d9a7a739cc3d6995
parent 2672d89c262f8c182cb8e19f999918fc02d6f16b
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date:   Fri, 15 Jun 2012 13:07:37 -0700

Merge pull request #4 from rysto32/master

Two fixes for handling of demangled C++ symbols
Diffstat:
Mflamegraph.pl | 16++++++++++------
Mstackcollapse-perf.pl | 2+-
Mstackcollapse-stap.pl | 2+-
Mstackcollapse.pl | 2+-
4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/flamegraph.pl b/flamegraph.pl @@ -135,8 +135,8 @@ my %Tmp; sub flow { my ($a, $b, $v) = @_; - my @A = split ",", $a; - my @B = split ",", $b; + my @A = split ";", $a; + my @B = split ";", $b; my $len_a = $#A; my $len_b = $#B; @@ -240,10 +240,11 @@ foreach my $id (keys %Node) { $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%)"; + my $escaped_func = $func; + $escaped_func =~ s/&/&amp;/g; + $escaped_func =~ s/</&lt;/g; + $escaped_func =~ s/>/&gt;/g; + $info = "$escaped_func ($samples samples, $pct%)"; } $im->filledRectangle($x1, $y1, $x2, $y2, color("hot"), 'rx="2" ry="2" onmouseover="s(' . "'$info'" . ')" onmouseout="c()"'); @@ -251,6 +252,9 @@ foreach my $id (keys %Node) { my $chars = int($width / (0.7 * $fontsize)); my $text = substr $func, 0, $chars; $text .= ".." if $chars < length $func; + $text =~ s/&/&amp;/g; + $text =~ s/</&lt;/g; + $text =~ s/>/&gt;/g; $im->stringTTF($black, $fonttype, $fontsize, 0.0, $x1 + 3, 3 + ($y1 + $y2) / 2, $text, "", 'onmouseover="s(' . "'$info'" . ')" onmouseout="c()"'); } diff --git a/stackcollapse-perf.pl b/stackcollapse-perf.pl @@ -68,7 +68,7 @@ foreach (<>) { chomp; if (m/^$/) { - remember_stack(join(",", @stack), 1) if @stack; + remember_stack(join(";", @stack), 1) if @stack; undef @stack; next; } diff --git a/stackcollapse-stap.pl b/stackcollapse-stap.pl @@ -64,7 +64,7 @@ foreach (<>) { chomp; if (m/^\s*(\d+)+$/) { - remember_stack(join(",", @stack), $1); + remember_stack(join(";", @stack), $1); @stack = (); next; } diff --git a/stackcollapse.pl b/stackcollapse.pl @@ -66,7 +66,7 @@ foreach (<>) { chomp; if (m/^\s*(\d+)+$/) { - remember_stack(join(",", @stack), $1); + remember_stack(join(";", @stack), $1); @stack = (); next; }