cmd/bent: exclude bss in size total Go commit fc88e18 added a substantial .noptrbss region to every program that includes the crypto packages. `size` reports this region as part of the total size of the binary, even though this section isn't realized in the ELF binary itself and is demand-paged only when FIPS 140-3 mode is enabled. Since we're interested in how big the binaries are on-disk and in-memory, grab the total size via stat. This should make this benchmark useful again. Change-Id: I05982932f2b2a6b9b31e737a0a8d90f0029564ef Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/727980 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/cmd/bent/scripts/benchsize b/cmd/bent/scripts/benchsize index 38fabcf..27de23d 100755 --- a/cmd/bent/scripts/benchsize +++ b/cmd/bent/scripts/benchsize
@@ -3,16 +3,13 @@ tmp=tmp-bench-size-$$ if [ `uname` = "Darwin" ] ; then - # e.g., `total 20986192` - totalawk='/^total/ {print $2}' # e.g., ` Section __text: 1445477` otherawk='$2 ~ "__.?%s:" {tot += $3} END {print tot}' size -m "$1" > $tmp wposix= + statflag="-f %z" else x=`which gsize` - # e.g., `Total 3879861` - totalawk='$1 == "Total" {print $2}' # e.g., `.text 1269331 4207296` # Field 2 is size, field 3 is address. otherawk='$1 ~ ".%s" {tot += $2} END {print tot}' @@ -22,6 +19,7 @@ "$x" -A "$1" > $tmp fi wposix="-Wposix" + statflag="--format %s" fi # $1: size output file @@ -36,9 +34,7 @@ fi } - -# note total is different -total=$(awk ${wposix} "${totalawk}" < ${tmp}) +total=$(stat $statflag "$1") text=$(find_section "${tmp}" "text") gopclntab=$(find_section "${tmp}" "gopclntab")