Files
MuditaOS/tools/stack-usage.sh
Marcin Smoczyński ea7264d434 [EGD-5941] Add tool to analyze stack usage
Add a script to determine a stack usage of code components.
The GENERATE_STACK_USAGE option must be used in the build configuration.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-03-01 13:27:44 +01:00

23 lines
458 B
Bash
Executable File

#!/usr/bin/bash
# make sure, that GENERATE_STACK_USAGE option has been enabled in cmake configuration
builddir=$1
minsize=$2
pattern=$3
if [ -z "$builddir" ]; then
echo "usage $0 builddir [minsize] [file name pattern]"
exit 1
fi
if [ -z $minsize ]; then
minsize=0
fi
if [ -n "$pattern" ]; then
FILTER="| egrep $pattern"
fi
eval find $builddir -name "*.su" $FILTER | xargs awk '{if ( $(NF-1) > '$minsize') print $(NF-1)" "$0}' | sort -n