Skip to content

Commit

Permalink
switch kernel to orange, and avoid spaces in collapsed output
Browse files Browse the repository at this point in the history
  • Loading branch information
brendangregg committed Dec 8, 2015
1 parent 16438e6 commit 942302d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions flamegraph.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand Down Expand Up @@ -1016,6 +1016,7 @@ sub flow {
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;
Expand Down
4 changes: 2 additions & 2 deletions stackcollapse-perf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ sub remember_stack {
--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
Expand Down Expand Up @@ -203,7 +203,7 @@ sub inline {
# 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;
Expand Down

0 comments on commit 942302d

Please sign in to comment.