Back to home page

OSCL-LXR

 
 

    


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