summaryrefslogtreecommitdiff
path: root/scripts/stackusage
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-10-13 10:28:16 +0200
committerJohannes Berg <johannes.berg@intel.com>2015-10-13 10:28:43 +0200
commit985f2c87a7109a42cac93f56ea595353d53a1746 (patch)
tree69fe0acbbfeb6a348d6f4c64750d278e56b935b3 /scripts/stackusage
parent4d57c67827d7bb79c4fcf6618bf80930808e50c6 (diff)
parent6623c60dc28ee966cd85c6f12aa2fc3c952d0179 (diff)
Merge remote-tracking branch 'net-next/master' into mac80211-next
Merge net-next to get some driver changes that patches depend on (in order to avoid conflicts). Signed-off-by: Johannes Berg <johannes.berg@intel.com>
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}"