From: Maninder Singh <maninder1.s@samsung.com>
To: yamada.masahiro@socionext.com, george_davis@mentor.com
Cc: linux-kernel@vger.kernel.org, a.sahrawat@samsung.com,
arnd@arndb.de, ak@linux.intel.com,
Maninder Singh <maninder1.s@samsung.com>,
Vaneet Narang <v.narang@samsung.com>
Subject: [PATCH v2 1/4] scripts/checkstack.pl: don't display $dre as different entity
Date: Fri, 8 May 2020 16:33:14 +0530 [thread overview]
Message-ID: <1588935797-7283-1-git-send-email-maninder1.s@samsung.com> (raw)
In-Reply-To: <CGME20200508110343epcas5p1ae3398e56ee895572487d05b730bd466@epcas5p1.samsung.com>
currently script prints stack usage for functions
in two ways:($re and $dre)
dre breaks sorting mechanism.
0xffffa00011f26f88 sunxi_mux_clk_setup.isra.0 [vmlinux]:Dynamic (0x140)
..
0xffffa00011f27210 sunxi_divs_clk_setup [vmlinux]: Dynamic (0x1d0)
so we can print it in decimal only.
Also address before function name is changed to function
start address rather than stack consumption address.
Because in next patch, arm has two ways to use stack
which can be clubbed and printed in one function only.
All symbols whose stack by adding(re and dre) is greater than
100, will be printed.
0xffffa00011f2720c0 sunxi_divs_clk_setup [vmlinux]: 464
...
0xffffa00011f26f840 sunxi_mux_clk_setup.isra.0 [vmlinux]:320
Co-developed-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
---
v1: https://lkml.org/lkml/2020/4/30/530
v2: review comments by Masahiro Yamada incorporated
scripts/checkstack.pl | 54 +++++++++++++++++++++++++--------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 371bd17..6957108 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -109,11 +109,30 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
#
# main()
#
-my ($func, $file, $lastslash);
+my ($func, $file, $lastslash, $total_size, $addr, $intro);
+
+$total_size = 0;
while (my $line = <STDIN>) {
if ($line =~ m/$funcre/) {
$func = $1;
+ next if $line !~ m/^($xs*)/;
+ if ($total_size > 100) {
+ push @stack, "$intro$total_size\n";
+ }
+
+ $addr = $1;
+ $addr =~ s/ /0/g;
+ $addr = "0x$addr";
+
+ $intro = "$addr $func [$file]:";
+ my $padlen = 56 - length($intro);
+ while ($padlen > 0) {
+ $intro .= ' ';
+ $padlen -= 8;
+ }
+
+ $total_size = 0;
}
elsif ($line =~ m/(.*):\s*file format/) {
$file = $1;
@@ -134,37 +153,18 @@ while (my $line = <STDIN>) {
}
next if ($size > 0x10000000);
- next if $line !~ m/^($xs*)/;
- my $addr = $1;
- $addr =~ s/ /0/g;
- $addr = "0x$addr";
-
- my $intro = "$addr $func [$file]:";
- my $padlen = 56 - length($intro);
- while ($padlen > 0) {
- $intro .= ' ';
- $padlen -= 8;
- }
- next if ($size < 100);
- push @stack, "$intro$size\n";
+ $total_size += $size;
}
elsif (defined $dre && $line =~ m/$dre/) {
- my $size = "Dynamic ($1)";
-
- next if $line !~ m/^($xs*)/;
- my $addr = $1;
- $addr =~ s/ /0/g;
- $addr = "0x$addr";
+ my $size = $1;
- my $intro = "$addr $func [$file]:";
- my $padlen = 56 - length($intro);
- while ($padlen > 0) {
- $intro .= ' ';
- $padlen -= 8;
- }
- push @stack, "$intro$size\n";
+ $size = hex($size) if ($size =~ /^0x/);
+ $total_size += $size;
}
}
+if ($total_size > 100) {
+ push @stack, "$intro$total_size\n";
+}
# Sort output by size (last field)
print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack;
--
1.9.1
next parent reply other threads:[~2020-05-08 11:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200508110343epcas5p1ae3398e56ee895572487d05b730bd466@epcas5p1.samsung.com>
2020-05-08 11:03 ` Maninder Singh [this message]
[not found] ` <CGME20200508110351epcas5p32b6adff3dd1cb36dd4912c82bb291bbd@epcas5p3.samsung.com>
2020-05-08 11:03 ` [PATCH v2 2/4] scripts/checkstack.pl: Add argument to print stacks greather than value Maninder Singh
[not found] ` <CGME20200508110354epcas5p3b80625f7ae03836a38547017b671268d@epcas5p3.samsung.com>
2020-05-08 11:03 ` [PATCH v2 3/4] scripts/checkstack.pl: add arm push handling for stack usage Maninder Singh
[not found] ` <CGME20200508110359epcas5p19f9e7bdbd7a9c2880308f5201f6badc9@epcas5p1.samsung.com>
2020-05-08 11:03 ` [PATCH v2 4/4] scripts/checkstack.pl: fix arm sp regex Maninder Singh
2020-05-09 7:42 ` [PATCH v2 1/4] scripts/checkstack.pl: don't display $dre as different entity Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1588935797-7283-1-git-send-email-maninder1.s@samsung.com \
--to=maninder1.s@samsung.com \
--cc=a.sahrawat@samsung.com \
--cc=ak@linux.intel.com \
--cc=arnd@arndb.de \
--cc=george_davis@mentor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=v.narang@samsung.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®