cmd/bent: address cherrymui's friction log
mention need for rsync & /usr/bin/time in README.md
fix GO111MODULE for capnproto2 in two benchmarks files
update "benchsize" for changes to macOS (verified ok for Big Sur)
Change-Id: Iafd03a9fb1535741dcd5373e0742d4696a5b3df2
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/342649
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/cmd/bent/README.md b/cmd/bent/README.md
index d594e75..2d55f62 100644
--- a/cmd/bent/README.md
+++ b/cmd/bent/README.md
@@ -6,6 +6,8 @@
Installation:
```go get github.com/dr2chase/bent```
+Requires commands `rsync` and `/usr/bin/time`.
+
Also depends on burntsushi/toml, and expects that Docker is installed and available on the command line.
You can avoid the need for Docker with the `-U` command line flag, if you're okay with running benchmarks outside containers.
Alternately, if you wish to only run those benchmarks that can be compiled into a container (this is platform-dependent)
diff --git a/cmd/bent/configs/benchmarks-50.toml b/cmd/bent/configs/benchmarks-50.toml
index 502d1fc..2ce36be 100644
--- a/cmd/bent/configs/benchmarks-50.toml
+++ b/cmd/bent/configs/benchmarks-50.toml
@@ -177,6 +177,7 @@
Name = "capnproto2"
Repo = "zombiezen.com/go/capnproto2/"
Benchmarks = "Benchmark(TextMovementBetweenSegments|Growth_MultiSegment)"
+ GcEnv = ["GO111MODULE=on"]
[[Benchmarks]]
Name = "uber_zap"
diff --git a/cmd/bent/configs/benchmarks-all.toml b/cmd/bent/configs/benchmarks-all.toml
index 3757fa2..5c6be49 100644
--- a/cmd/bent/configs/benchmarks-all.toml
+++ b/cmd/bent/configs/benchmarks-all.toml
@@ -190,6 +190,7 @@
Name = "capnproto2"
Repo = "zombiezen.com/go/capnproto2/"
Benchmarks = "Benchmark"
+ GcEnv = ["GO111MODULE=on"]
[[Benchmarks]]
Name = "uber_zap"
diff --git a/cmd/bent/scripts/benchsize b/cmd/bent/scripts/benchsize
index 5f9e382..4b48be1 100755
--- a/cmd/bent/scripts/benchsize
+++ b/cmd/bent/scripts/benchsize
@@ -2,30 +2,36 @@
tmp=tmp-bench-size-$$
-x=`which gsize`
-
-if [ "x$x" = "x" ] ; then
- size -A "$1" > $tmp
-else
- "$x" -A "$1" > $tmp
+if [ `uname` = "Darwin" ] ; then
+ awkcommand='{print $3}'
+ size -m "$1" > $tmp
+ else
+ x=`which gsize`
+ awkcommand='{print $2}'
+ if [ "x$x" = "x" ] ; then
+ size -A "$1" > $tmp
+ else
+ "$x" -A "$1" > $tmp
+ fi
fi
+# note total is different -- always $2
+total=`egrep -i '^total' $tmp | awk -Wposix '{print $2}'`
-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}'`
+text=`egrep [^a-z]text[^a-z] $tmp | awk -Wposix "$awkcommand"`
+gopclntab=`grep gopclntab $tmp | awk -Wposix "$awkcommand"`
+rodata=`grep rodata $tmp | awk -Wposix "$awkcommand"`
+data=`egrep [^a-z]data[^a-z._] $tmp | awk -Wposix "$awkcommand"`
-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_info=`grep zdebug_info $tmp | awk -Wposix "$awkcommand"`
+zdebug_loc=`grep zdebug_loc $tmp | awk -Wposix "$awkcommand"`
+zdebug_line=`grep zdebug_line $tmp | awk -Wposix "$awkcommand"`
+zdebug_ranges=`grep zdebug_ranges $tmp | awk -Wposix "$awkcommand"`
+zdebug_frame=`grep zdebug_frame $tmp | awk -Wposix "$awkcommand"`
+zdebug_abbrev=`grep zdebug_abbrev $tmp | awk -Wposix "$awkcommand"`
+zdebug_pubname=`grep zdebug_pubname $tmp | awk -Wposix "$awkcommand"`
+zdebug_pubtype=`grep zdebug_pubtype $tmp | awk -Wposix "$awkcommand"`
zdebug_abbrev=${zdebug_abbrev:-0}
zdebug_pubname=${zdebug_pubname:-0}
@@ -40,7 +46,6 @@
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