aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@xenotime.net>2006-06-25 08:48:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:15 -0400
commit8ad2914d9cc55be651ef3bd676981a72c9001a47 (patch)
tree4bba45d178fd4f48959fccc906b2287c52d09efe /scripts
parent5ec3e4b7aefbb8613b27ec4449fa8f9916ab9099 (diff)
[PATCH] checkstack: print module names
Finding "init_module" high stack usage problems is challenging when there are over 1600 "init_module" functions in the kernel tree, so make checkstack.pl print out the filename where the stack usage occurs. This is useful for code built as loadable modules. For built-in code, it just prints the kernel image file name, like "vmlinux". Examples: (before patch:) 0x0000000d callback: 1928 0xffffffff81678c09 huft_build: 1560 0x0018 init_module: 1512 (after patch:) 0x0000000d callback [divacapi]: 1928 0xffffffff81678c09 huft_build [vmlinux]: 1560 0x0018 init_module [hdaps]: 1512 Also change one if-series to use elsif to cut down on unneeded tests. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: Joern Engel <joern@wh.fh-wedel.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkstack.pl14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index dadfa20ffec0..b34924663ac1 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -89,11 +89,21 @@ sub bysize($) {
89# 89#
90my $funcre = qr/^$x* <(.*)>:$/; 90my $funcre = qr/^$x* <(.*)>:$/;
91my $func; 91my $func;
92my $file, $lastslash;
93
92while (my $line = <STDIN>) { 94while (my $line = <STDIN>) {
93 if ($line =~ m/$funcre/) { 95 if ($line =~ m/$funcre/) {
94 $func = $1; 96 $func = $1;
95 } 97 }
96 if ($line =~ m/$re/) { 98 elsif ($line =~ m/(.*):\s*file format/) {
99 $file = $1;
100 $file =~ s/\.ko//;
101 $lastslash = rindex($file, "/");
102 if ($lastslash != -1) {
103 $file = substr($file, $lastslash + 1);
104 }
105 }
106 elsif ($line =~ m/$re/) {
97 my $size = $1; 107 my $size = $1;
98 $size = hex($size) if ($size =~ /^0x/); 108 $size = hex($size) if ($size =~ /^0x/);
99 109
@@ -109,7 +119,7 @@ while (my $line = <STDIN>) {
109 $addr =~ s/ /0/g; 119 $addr =~ s/ /0/g;
110 $addr = "0x$addr"; 120 $addr = "0x$addr";
111 121
112 my $intro = "$addr $func:"; 122 my $intro = "$addr $func [$file]:";
113 my $padlen = 56 - length($intro); 123 my $padlen = 56 - length($intro);
114 while ($padlen > 0) { 124 while ($padlen > 0) {
115 $intro .= ' '; 125 $intro .= ' ';