@@ -1,13 +1,16 @@
3print_help () {
3print_help () {
5+ echo " [--quick] [--append] "
4− echo "Usage: $0 [--quick] [--append] [--no-graphs] [--no-measure] \
6+ echo " [--no-graphs] [--no-measure]"
5−[--no-compare] [--base commit] [--candidate commit] -- <gauge options>"
8+ echo " [--compare] [--base commit] [--candidate commit]"
9+ echo " -- <gauge options>"
7− echo "Default generates comparative chart of HEAD^ vs HEAD commit, "
11+ echo "When using --compare, by default comparative chart of HEAD^ vs HEAD"
12+ echo "commit is generated, in the 'charts' directory."
8− echo "in the 'charts' directory. Use --base and --candidate to select "
13+ echo "Use --base and --candidate to select the commits to compare."
9− echo "the commits to compare. Use --no-compare to just benchmark the "
10− echo "current workspace only."
12 echo "Any arguments after a '--' are passed directly to guage"
15 echo "Any arguments after a '--' are passed directly to guage"
13 echo "You can omit '--' if the gauge args used do not start with a '-'."
16 echo "You can omit '--' if the gauge args used do not start with a '-'."
@@ -20,7 +23,8 @@ die () {
26+DEFAULT_BENCHMARK=linear
25while test -n "$1"
29while test -n "$1"
@@ -28,9 +32,10 @@ do
28 -h|--help|help) print_help ;;
32 -h|--help|help) print_help ;;
29 --quick) QUICK=1; shift ;;
33 --quick) QUICK=1; shift ;;
30 --append) APPEND=1; shift ;;
34 --append) APPEND=1; shift ;;
35+ --benchmark) shift; BENCHMARK=$1; shift ;;
31 --base) shift; BASE=$1; shift ;;
36 --base) shift; BASE=$1; shift ;;
32 --candidate) shift; CANDIDATE=$1; shift ;;
37 --candidate) shift; CANDIDATE=$1; shift ;;
33− --no-compare) COMPARE=0; shift ;;
38+ --compare) COMPARE=1; shift ;;
34 --no-graphs) GRAPH=0; shift ;;
39 --no-graphs) GRAPH=0; shift ;;
35 --no-measure) MEASURE=0; shift ;;
40 --no-measure) MEASURE=0; shift ;;
36 --) shift; break ;;
41 --) shift; break ;;
@@ -48,18 +53,21 @@ echo "Using stack command [$STACK]"
48# for benchmarking.
53# for benchmarking.
49if test "$GRAPH" != "0"
54if test "$GRAPH" != "0"
56+ CHART_PROG="chart-$BENCHMARK"
51− CHARTS=$($STACK exec which charts)
57+ prog=$($STACK exec which $CHART_PROG)
52− if test ! -x $CHARTS
58+ if test ! -x "$prog"
54− echo "Building charts executable"
60+ echo "Building charting executable"
55 $STACK build --flag "streamly:dev" || die "build failed"
61 $STACK build --flag "streamly:dev" || die "build failed"
58− CHARTS=$($STACK exec which charts)
64+ prog=$($STACK exec which $CHART_PROG)
59− if test ! -x $CHARTS
65+ if test ! -x "$prog"
61− die "Could not find 'charts' executable"
67+ die "Could not find [$CHART_PROG] executable"
70+ echo "Using chart executable [$CHART_PROG]"
65# We run the benchmarks in isolation in a separate process so that different
73# We run the benchmarks in isolation in a separate process so that different
@@ -72,7 +80,14 @@ fi
72# find .stack-work/ -type f -name "benchmarks"
80# find .stack-work/ -type f -name "benchmarks"
74find_bench_prog () {
82find_bench_prog () {
83+ if test -z "$BENCHMARK"
85+ BENCHMARK=$DEFAULT_BENCHMARK
86+ echo "Using default benchmark suite [$BENCHMARK], use --benchmark to specify another"
88+ echo "Using benchmark suite [$BENCHMARK]"
75− BENCH_PROG=`$STACK path --dist-dir`/build/benchOps/benchOps
90+ BENCH_PROG=`$STACK path --dist-dir`/build/$BENCHMARK/$BENCHMARK
76 if test ! -x "$BENCH_PROG"
91 if test ! -x "$BENCH_PROG"
@@ -154,7 +169,7 @@ if test "$GRAPH" != "0"
156 echo "Generating charts from ${OUTPUT_FILE}..."
171 echo "Generating charts from ${OUTPUT_FILE}..."
157− $CHARTS
172+ $CHART_PROG
160# XXX reset back to the original commit
175# XXX reset back to the original commit