Permalink
Browse files

Fix stackcollapse-perf for C++ userland profiling

This fixes handling of function names with '::' involved, which
show up in C++ if you pass the perf script output through
demangling prior to stackcollapse-perf.

Also disables the skipping of non-kernel code -- perf is equally
useful for profiling user applications.
  • Loading branch information...
1 parent 9e00484 commit d99115a8a42736b42ae763f67c6871b8f07c1042 @toddlipcon toddlipcon committed Mar 29, 2013
Showing with 8 additions and 4 deletions.
  1. +8 −4 stackcollapse-perf.pl
View
@@ -75,13 +75,17 @@ sub remember_stack {
# Note the details skipped below, and customize as desired
- next if m/:.*:/; # skip summary lines
+ if (m/:.*:\s$/) {
+ # skip summary lines
+ next;
+ }
- if (/^\s*\w+ (\w+) (\S+)/) {
+ if (/^\s*\w+\s*(.+) (\S+)/) {
my ($func, $mod) = ($1, $2);
- next if $func =~ /\(/; # skip process names
- next unless $mod =~ /kernel/; # skip non-kernel
+ next if $func =~ /^\(/; # skip process names
unshift @stack, $func;
+ } else {
+ warn "Unrecognized line: $_";
}
}

0 comments on commit d99115a

Please sign in to comment.