commit 0cd5305ce0d4503ecc69cee466295db2fbf62211
parent 8f276768d414d93fbf0f5951e055cbeab743fb28
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Tue, 7 Oct 2014 13:28:10 -0700
Merge pull request #34 from fpavageau/shorten_packages
Shorten Java package names
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/stackcollapse-jstack.pl b/stackcollapse-jstack.pl
@@ -68,6 +68,7 @@ my @stack;
my $pname;
my $include_pname = 1; # include process names in stacks
my $include_tid = 0; # include thread IDs in stacks
+my $shorten_pkgs = 0; # shorten package names
my $state = "?";
foreach (<>) {
@@ -114,6 +115,11 @@ clear:
$state = $1 if $state eq "?";
} elsif (/^\s*at ([^\(]*)/) {
my $func = $1;
+ if ($shorten_pkgs) {
+ my ($pkgs, $clsFunc) = ( $func =~ m/(.*\.)([^.]+\.[^.]+)$/ );
+ $pkgs =~ s/(\w)\w*/$1/g;
+ $func = $pkgs . $clsFunc;
+ }
unshift @stack, $func;
# fix state for epollWait