Back to home page

LXR

 
 

    


0001 #!/bin/sh
0002 
0003 outfile=""
0004 now=`date +%s`
0005 
0006 while [ $# -gt 0 ]
0007 do
0008     case "$1" in
0009         -o)
0010             outfile="$2"
0011             shift 2;;
0012         -h)
0013             echo "usage: $0 [-o outfile] <make options/args>"
0014             exit 0;;
0015         *)  break;;
0016     esac
0017 done
0018 
0019 if [ -z "$outfile" ]
0020 then
0021     outfile=`mktemp --tmpdir stackusage.$$.XXXX`
0022 fi
0023 
0024 KCFLAGS="${KCFLAGS} -fstack-usage" make "$@"
0025 
0026 # Prepend directory name to file names, remove column information,
0027 # make file:line/function/size/type properly tab-separated.
0028 find . -name '*.su' -newermt "@${now}" -print |                     \
0029     xargs perl -MFile::Basename -pe                                 \
0030         '$d = dirname($ARGV); s#([^:]+:[0-9]+):[0-9]+:#$d/$1\t#;' | \
0031     sort -k3,3nr > "${outfile}"
0032 
0033 echo "$0: output written to ${outfile}"