flamegraph

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

commit 942302d9b99e2589acbe0bd5e8f0ac4982c7951b
parent 16438e681512334ea3d0893b1147056f9cd11e10
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date:   Tue,  8 Dec 2015 02:05:07 -0800

switch kernel to orange, and avoid spaces in collapsed output

Diffstat:
Mflamegraph.pl | 13+++++++------
Mstackcollapse-perf.pl | 4++--
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/flamegraph.pl b/flamegraph.pl @@ -335,8 +335,8 @@ sub color { $type = "yellow"; } elsif ($name =~ m:/:) { # Java (match "/" in path) $type = "green" - } elsif ($name =~ m: \[k\]:) { # kernel - $type = "purple" + } elsif ($name =~ m:_\[k\]:) { # kernel + $type = "orange" } else { # system $type = "red"; } @@ -347,8 +347,8 @@ sub color { $type = "yellow"; } elsif ($name =~ m:Perl: or $name =~ m:\.pl:) { # Perl $type = "green"; - } elsif ($name =~ m: \[k\]:) { # kernel - $type = "purple" + } elsif ($name =~ m:_\[k\]:) { # kernel + $type = "orange" } else { # system $type = "red"; } @@ -363,8 +363,8 @@ sub color { $type = "aqua" } elsif ($name =~ m/^ $/) { # Missing symbol $type = "green" - } elsif ($name =~ m: \[k\]:) { # kernel - $type = "purple" + } elsif ($name =~ m:_\[k\]:) { # kernel + $type = "orange" } else { # system $type = "red"; } @@ -1016,6 +1016,7 @@ while (my ($id, $node) = each %Node) { my $chars = int( ($x2 - $x1) / ($fontsize * $fontwidth)); my $text = ""; if ($chars >= 3) { # room for one char plus two dots + $func =~ s/_\[k\]$//; # strip any kernel annotation $text = substr $func, 0, $chars; substr($text, -2, 2) = ".." if $chars < length $func; $text =~ s/&/&amp;/g; diff --git a/stackcollapse-perf.pl b/stackcollapse-perf.pl @@ -92,7 +92,7 @@ USAGE: $0 [options] infile > outfile\n --pid # include PID with process names [1] --tid # include TID and PID with process names [1] --inline # un-inline using addr2line - --kernel # annotate kernel functions with a [k] + --kernel # annotate kernel functions with a _[k] --context # include source context from addr2line\n [1] perf script must emit both PID and TIDs for these to work; eg: perf script -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace @@ -203,7 +203,7 @@ while (defined($_ = <>)) { # stack line } elsif (/^\s*(\w+)\s*(.+) \((\S*)\)/) { my ($pc, $func, $mod) = ($1, $2, $3); - $func.=" [k]" if ($annotate_kernel == 1 && $mod =~ m/kernel.kall/); + $func.="_[k]" if ($annotate_kernel == 1 && $mod =~ m/kernel.kall/); if ($show_inline == 1 && index($mod, $target_pname) != -1) { unshift @stack, inline($pc, $mod); next;