summaryrefslogtreecommitdiff
path: root/scripts/benchalloc.sh
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-13 16:56:12 +1000
committerAdam Scarr <adam@vektah.net>2017-08-13 16:56:12 +1000
commit0dc37ae5bc10cc0669f88ab9febbc039a28f23d1 (patch)
tree0395aac5ab5223a4390eb03b22455ed3c98b6c90 /scripts/benchalloc.sh
parentf633909141dc1e2c2e49b94e5e478e99be51a9cb (diff)
Remove a few allocs from Run
Diffstat (limited to 'scripts/benchalloc.sh')
-rw-r--r--scripts/benchalloc.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/benchalloc.sh b/scripts/benchalloc.sh
new file mode 100644
index 0000000..8409938
--- /dev/null
+++ b/scripts/benchalloc.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if [ $# != 1 ] ; then
+ echo Run this in a directory containing benchmarks and pass it the name of a benchmark. It will dump allocations out to trace.log
+ exit
+fi
+
+set -eu
+
+go test -c
+
+GODEBUG=allocfreetrace=1 ./$(basename $(pwd)).test.exe -test.run=none -test.bench=$1 -test.benchmem -test.benchtime=1ns 2> >(sed -n '/benchmark.go:75/,$p' > trace.log)