Skip to content

Commit

Permalink
scripts/checkstack.pl: Add argument to print stacks greather than value.
Browse files Browse the repository at this point in the history
Add arguments support to print stacks which are greater than
argument value only.

Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
  • Loading branch information
maninder42 authored and intel-lab-lkp committed Apr 30, 2020
1 parent 07fcab9 commit 71dbdfe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/checkstack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@
# $1 (first bracket) matches the dynamic amount of the stack growth
#
# use anything else and feel the pain ;)
my (@stack, $re, $dre, $x, $xs, $funcre);
my (@stack, $re, $dre, $x, $xs, $funcre, $min_stack);
{
my $arch = shift;
if ($arch eq "") {
$arch = `uname -m`;
chomp($arch);
}

$min_stack = shift;
if ($min_stack eq "" || $min_stack !~ /^\d+$/) {
$min_stack = 100;
}

$x = "[0-9a-f]"; # hex character
$xs = "[0-9a-f ]"; # hex character or space
$funcre = qr/^$x* <(.*)>:$/;
Expand Down Expand Up @@ -113,7 +118,7 @@

while (my $line = <STDIN>) {
if ($line =~ m/$funcre/) {
if ($total_size > 100) {
if ($total_size > $min_stack) {
push @stack, "$intro$total_size\n";
}

Expand Down Expand Up @@ -150,7 +155,6 @@
$size += 0x80000000;
}
next if ($size > 0x10000000);

$total_size = $total_size + $size
}
elsif (defined $dre && $line =~ m/$dre/) {
Expand All @@ -160,7 +164,7 @@
$total_size = $total_size + $size
}
}
if ($total_size > 100) {
if ($total_size > $min_stack) {
push @stack, "$intro$total_size\n";
}

Expand Down

0 comments on commit 71dbdfe

Please sign in to comment.