dwz/contrib/bytes-per-die.sh

17 lines
332 B
Bash
Raw Normal View History

2022-08-25 18:00:22 +08:00
#!/bin/bash
f="$1"
size=$(readelf -WS "$f" \
2023-03-23 16:03:44 +08:00
| grep -E "[ \t]\.debug_info" \
2022-08-25 18:00:22 +08:00
| sed 's/.*\.debug_info//' \
| awk '{print $4}')
size=$((16#$size))
nr_dies=$(readelf -wi "$f" \
| grep -c ': Abbrev Number.*(DW_TAG')
res=$(echo "scale=2; $size / $nr_dies" \
| bc)
echo -e "$res\tsize: $size\tnr_dies: $nr_dies"