diff --git a/stackcollapse-wcp.pl b/stackcollapse-wcp.pl index 4d1d584..f92fbb7 100755 --- a/stackcollapse-wcp.pl +++ b/stackcollapse-wcp.pl @@ -27,12 +27,19 @@ # CDDL HEADER END use strict; +use Getopt::Long; my $current = ""; my $start_processing = 0; my $samples = 0; my %stacks; +my $lines = 0; +GetOptions( + 'lines|l' => \$lines, +); + + while(<>) { s/^\s+|\s+$//g; @@ -49,7 +56,9 @@ # 99.791% ===================================== (17194 samples) $samples = $1; next; - } elsif (m/^\d+: (.*)$/) { + } + + if (($lines && m/^\d+: (.*)$/) || (!$lines && m/^\d+: (.*) +\(at .*\)$/)) { # 1: poll__YNjd8fE6xG8CRNwfLnrx0g_2 (at /mnt/sde1/storage/nim-beacon-chain-clean/vendor/nim-chronos/chronos/asyncloop.nim:343) my $function = $1; if ($current eq "") {