Skip to content

Commit

Permalink
[deps] Improve wedge report
Browse files Browse the repository at this point in the history
Sum wedge sizes with awk.
  • Loading branch information
Andy C committed Jan 19, 2024
1 parent ec50d84 commit 4c264e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
39 changes: 28 additions & 11 deletions build/deps.sh
Expand Up @@ -459,26 +459,43 @@ commas() {
sed ':a;s/\b\([0-9]\+\)\([0-9]\{3\}\)\b/\1,\2/;ta'
}

show-wedge-tree() {
# 4 levels deep shows the package
if command -v tree > /dev/null; then
tree -L 4 /wedge ~/wedge
echo
fi

wedge-sizes() {
# Sizes
# printf justifies du output
du -s --bytes /wedge/*/*/* ~/wedge/*/*/* | commas | xargs -n 2 printf '%15s %s\n'

local tmp=_tmp/wedge-sizes.txt
du -s --bytes /wedge/*/*/* ~/wedge/*/*/* | awk '
{ print $0 # print the line
total_bytes += $1 # accumulate
}
END { print total_bytes " TOTAL" }
' > $tmp

cat $tmp | commas | xargs -n 2 printf '%15s %s\n'
echo

#du -s --si /wedge/*/*/* ~/wedge/*/*/*
#echo
}

local tmp=_tmp/wedge-tree.txt
wedge-report() {
# 4 levels deep shows the package
if command -v tree > /dev/null; then
tree -L 4 /wedge ~/wedge
echo
fi

# Show the biggest files
wedge-sizes

local tmp=_tmp/wedge-manifest.txt

echo 'Biggest files'
find /wedge ~/wedge -type f -a -printf '%10s %P\n' > $tmp
sort -n $tmp | tail -n 20 | commas

set +o errexit # ignore SIGPIPE
sort -n --reverse $tmp | head -n 20 | commas
set -o errexit

echo

# Show the most common file extensions
Expand Down
2 changes: 1 addition & 1 deletion soil/worker.sh
Expand Up @@ -72,7 +72,7 @@ fetch build/deps.sh fetch -
install-wedges build/deps.sh install-wedges -
py-all-and-ninja soil/worker.sh py-all-and-ninja -
smoke-test build/dev-setup-test.sh smoke-test -
show-wedge-tree build/deps.sh show-wedge-tree -
wedge-report build/deps.sh wedge-report -
EOF

# Fails on Ubuntu 20 because python2-dev isn't set up
Expand Down

0 comments on commit 4c264e1

Please sign in to comment.