From 46c1a0b108db25938f5a146dd7dcfd38d2f79d11 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Mon, 19 Feb 2024 01:29:23 +0100 Subject: [PATCH 1/2] Remove line number from stackcollapse-wcp output --- stackcollapse-wcp.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stackcollapse-wcp.pl b/stackcollapse-wcp.pl index 4d1d5843..40f0ac73 100755 --- a/stackcollapse-wcp.pl +++ b/stackcollapse-wcp.pl @@ -49,7 +49,7 @@ # 99.791% ===================================== (17194 samples) $samples = $1; next; - } elsif (m/^\d+: (.*)$/) { + } elsif (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 "") { From 05e9b55eb95952eabdd33caf4d2044a41316f5c3 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Wed, 21 Feb 2024 10:48:59 +0100 Subject: [PATCH 2/2] Add off-by-default option to separate graph by lines --- stackcollapse-wcp.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stackcollapse-wcp.pl b/stackcollapse-wcp.pl index 40f0ac73..f92fbb71 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+: (.*) +\(at .*\)$/) { + } + + 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 "") {