blob: 5f9e3823175133c9f9faf9d9b12ebe4330e7912e [file] [log] [blame]
#!/bin/bash
tmp=tmp-bench-size-$$
x=`which gsize`
if [ "x$x" = "x" ] ; then
size -A "$1" > $tmp
else
"$x" -A "$1" > $tmp
fi
total=`grep Total $tmp | awk '{print $2}'`
text=`egrep [^a-z]text[^a-z] $tmp | awk '{print $2}'`
gopclntab=`grep gopclntab $tmp | awk '{print $2}'`
rodata=`grep rodata $tmp | awk '{print $2}'`
data=`egrep [^a-z]data[^a-z._] $tmp | awk '{print $2}'`
zdebug_info=`grep zdebug_info $tmp | awk '{print $2}'`
zdebug_loc=`grep zdebug_loc $tmp | awk '{print $2}'`
zdebug_line=`grep zdebug_line $tmp | awk '{print $2}'`
zdebug_ranges=`grep zdebug_ranges $tmp | awk '{print $2}'`
zdebug_frame=`grep zdebug_frame $tmp | awk '{print $2}'`
zdebug_abbrev=`grep zdebug_abbrev $tmp | awk '{print $2}'`
zdebug_pubname=`grep zdebug_pubname $tmp | awk '{print $2}'`
zdebug_pubtype=`grep zdebug_pubtype $tmp | awk '{print $2}'`
zdebug_abbrev=${zdebug_abbrev:-0}
zdebug_pubname=${zdebug_pubname:-0}
zdebug_pubtype=${zdebug_pubtype:-0}
echo "goos: $GOOS"
echo "goarch: $GOARCH"
echo "pkg:" # Erase any inherited pkg if files are concatenated
echo "Benchmark${2}_total" 1 ${total} total-bytes
echo "Benchmark${2}_text" 1 ${text} text-bytes
echo "Benchmark${2}_data" 1 ${data} data-bytes
echo "Benchmark${2}_rodata" 1 ${rodata} rodata-bytes
echo "Benchmark${2}_pclntab" 1 ${gopclntab} pclntab-bytes
zdebug=`expr ${zdebug_info} + ${zdebug_loc} + ${zdebug_line} + ${zdebug_ranges} + ${zdebug_frame} + ${zdebug_abbrev} + ${zdebug_pubname} + ${zdebug_pubtype}`
echo "Benchmark${2}_zdebug_total" 1 ${zdebug} zdebug-bytes
# echo "Benchmark${2}_zdebug_info" 1 ${zdebug_info} zdebugbytes
# echo "Benchmark${2}_zdebug_loc" 1 ${zdebug_loc} zdebugbytes
# echo "Benchmark${2}_zdebug_line" 1 ${zdebug_line} zdebugbytes
# echo "Benchmark${2}_zdebug_ranges" 1 ${zdebug_ranges} zdebugbytes
# echo "Benchmark${2}_zdebug_frame" 1 ${zdebug_frame} zdebugbytes
# echo "Benchmark${2}_zdebug_pubtype" 1 ${zdebug_pubtype} zdebugbytes
# echo "Benchmark${2}_zdebug_pubname" 1 ${zdebug_pubname} zdebugbytes
rm $tmp