From 0fb03d35dc813ca5b40a26b4281eab2544789f84 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 15 Nov 2013 19:14:48 -0800 Subject: [PATCH] simpler, more compatible benchmarking script --- Makefile | 2 ++ bench.sh | 29 ++++++++++------------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 0a96b47..e0d066b 100644 --- a/Makefile +++ b/Makefile @@ -56,9 +56,11 @@ install: all install -d ${LADSPADEST} install -m 644 ${SHOBJ} ${LADSPADEST} +.PHONY: clean clean: -rm -f ${ALL} bench ${BENCH} +.PHONY: dist dist: -rm -f ${FULLNAME}.tar.gz mkdir -p ${FULLNAME} diff --git a/bench.sh b/bench.sh index 01f5ca3..d6a8d73 100755 --- a/bench.sh +++ b/bench.sh @@ -1,19 +1,10 @@ -#!/bin/zsh -local bench="$1" -local against="$2" -local i x n=0 t m=9999 -finish() { - [ $n -gt 0 ] && printf "\nmin %.3f avg %.3f total %.3f\n" $m $((x/n)) $x - exit 0 -} -trap finish INT -echo -n "…" -for ((i=0; i<8; i++)); do - sleep 0.5 - t="$(TIMEFMT='%*E'$'\n'; (time "$bench" "$against") 2>&1)" - echo -n " ${t}" - let 'x += t' - let 'n += 1' - [[ $t < $m ]] && m=$t -done -finish +#!/bin/bash +bench="$1" +against="$2" + +TIMEFORMAT='%3R' +for i in {1..8}; do + time "$bench" "$against" +done 2>&1 >/dev/null | awk 'BEGIN{m=999;printf " …\033[90m"} +{a+=$1;n++;m=$1