flamegraph

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

commit b0bef43381d7723f9a821324bda8115460574a97
parent 854514f356fd25bbb30b8e6fb06cac137f5a464a
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date:   Sun, 18 Sep 2022 10:33:49 +1000

Merge pull request #258 from jfernandez/master

Update stackcollapse-bpftrace to work with book examples
Diffstat:
Mstackcollapse-bpftrace.pl | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/stackcollapse-bpftrace.pl b/stackcollapse-bpftrace.pl @@ -51,15 +51,21 @@ my $in_stack = 0; foreach (<>) { chomp; if (!$in_stack) { - if (/^@\[/) { + if (/^@\[$/) { $in_stack = 1; + } elsif (/^@\[,\s(.*)\]: (\d+)/) { + print $1 . " $2\n"; } } else { - if (m/^\]: (\d+)/) { - print join(';', reverse(@stack)) . " $1\n"; + if (m/^,?\s?(.*)\]: (\d+)/) { + if (length $1) { + push(@stack, $1); + } + print join(';', reverse(@stack)) . " $2\n"; $in_stack = 0; @stack = (); } else { + $_ =~ s/^\s+//; push(@stack, $_); } }