From 7065b987d3ae4a4d9eaab177aba5edf82ffa1b93 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 27 Aug 2021 11:22:59 +0100 Subject: Add bloatysizes for finding code bloat --- bashrc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 3e62a7e..4ef2ce0 100644 --- a/bashrc +++ b/bashrc @@ -80,8 +80,16 @@ sizes() { column -N module,binary,size -R module,binary,size -t -s $'\t' } -PATH="/usr/lib/ccache/bin:$PATH" -CORES=$(grep core\ id /proc/cpuinfo | sort -u | wc -l) +bloatysizes() { + MODE="variant=release strip=off debug-symbols=on testing.execute=off" + TARGETS=$(build $MODE $@ -and1 | grep '^\(gcc\|clang-linux\)\.link' | cut -d ' ' -f 2) + TARGET="$(echo ${TARGETS} | awk '{ print $NF }')" + if [[ -z $TARGETS ]] ; then return ; fi + build $MODE -d1 $@ + ls -lh $TARGET + bloaty -s vm --domain=vm -d symbols -C full -n 0 $TARGET | tee /var/tmp/bloaty +} + CPUS=$(grep core\ id /proc/cpuinfo -c) if [ -n "$DISTCC_HOSTS" ] ; then TASKS=$(echo $DISTCC_HOSTS | tr ' ' '\n' | cut -d / -f2 | paste -s -d+ | bc) -- cgit v1.2.3