summaryrefslogtreecommitdiffstats
path: root/scripts/stackusage
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 14:23:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 14:23:13 -0700
commitd9241b22b58e012f26dd2244508d9f4837402af0 (patch)
treee8359d16b76e0c109d4bbaccf093765c373d9f24 /scripts/stackusage
parent605e9710fb5fef0dd2bb49d7b75e46601df62112 (diff)
parent3716001bcb7f5822382ac1f2f54226b87312cc6b (diff)
downloadlinux-d9241b22b58e012f26dd2244508d9f4837402af0.tar.gz
linux-d9241b22b58e012f26dd2244508d9f4837402af0.tar.bz2
linux-d9241b22b58e012f26dd2244508d9f4837402af0.zip
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek: - deb-pkg: + module signing fix + dtb files are added to the package + do not require `hostname -f` to work during build + make deb-pkg generates a source package, bindeb-pkg has been added to only generate the binary package - rpm-pkg packages /lib/modules as well - new coccinelle patch and updates to existing ones - new stackusage & stackdelta script to collect and compare stack usage info (using gcc's -fstack-usage) - make tags understands trace_*_rcuidle() macros - .gitignore updates, misc cleanups * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (27 commits) deb-pkg: add source package package/Makefile: move source tar creation to a function scripts: add stackdelta script kbuild: remove *.su files generated by -fstack-usage .gitignore: add *.su pattern scripts: add stackusage script kbuild: avoid listing /lib/modules in kernel spec file fallback to hostname in scripts/package/builddeb coccinelle: api: extend spatch for dropping unnecessary owner deb-pkg: simplify directory creation scripts/tags.sh: Include trace_*_rcuidle() in tags scripts/package/Makefile: rpmbuild is needed for rpm targets Kbuild: Add ID files to .gitignore gitignore: Add MIPS vmlinux.32 to the list coccinelle: simple_return: Add a blank line coccinelle: irqf_oneshot.cocci: Improve the generated commit log coccinelle: api: add vma_pages.cocci scripts/coccinelle/misc/irqf_oneshot.cocci: Fix grammar scripts/coccinelle/misc/semicolon.cocci: Use imperative mood coccinelle: simple_open: Use imperative mood ...
Diffstat (limited to 'scripts/stackusage')
-rwxr-xr-xscripts/stackusage33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/stackusage b/scripts/stackusage
new file mode 100755
index 000000000000..8cf26640ef8a
--- /dev/null
+++ b/scripts/stackusage
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+outfile=""
+now=`date +%s`
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -o)
+ outfile="$2"
+ shift 2;;
+ -h)
+ echo "usage: $0 [-o outfile] <make options/args>"
+ exit 0;;
+ *) break;;
+ esac
+done
+
+if [ -z "$outfile" ]
+then
+ outfile=`mktemp --tmpdir stackusage.$$.XXXX`
+fi
+
+KCFLAGS="${KCFLAGS} -fstack-usage" make "$@"
+
+# Prepend directory name to file names, remove column information,
+# make file:line/function/size/type properly tab-separated.
+find . -name '*.su' -newermt "@${now}" -print | \
+ xargs perl -MFile::Basename -pe \
+ '$d = dirname($ARGV); s#([^:]+:[0-9]+):[0-9]+:#$d/$1\t#;' | \
+ sort -k3,3nr > "${outfile}"
+
+echo "$0: output written to ${outfile}"