on master help sign in
Move the bench-runner script to bench-report pkg
cffe012Harendra Kumar
benchmark/bench-report/bin/bench-runner.sh+7−32
@@ -77,39 +77,17 @@ list_comparisons () {
77 echo
77 echo
78}
78}
79
79
80−# chart is expensive to build and usually not required to be rebuilt
81−cabal_which_report() {
82− local path="./bin/$1"
83− if test -e "$path"
84− then
85− echo $path
86− fi
87−}
88−
89−find_report_prog() {
90− local prog_name="bench-report"
91− hash -r
92− local prog_path=$(cabal_which_report $prog_name)
93− if test -x "$prog_path"
94− then
95− echo $prog_path
96− else
97− return 1
98− fi
99−}
100−
101build_report_prog() {
80build_report_prog() {
102− local prog_name="bench-report"
81+ local prog_path=$BENCH_REPORT_DIR/bin/bench-report
103− local prog_path=$(cabal_which_report $prog_name)
104
82
105 hash -r
83 hash -r
106 if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
84 if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
107 then
85 then
108 echo "Building bench-report executables"
86 echo "Building bench-report executables"
109 BUILD_ONCE=1
87 BUILD_ONCE=1
110− pushd $BENCHMARK_DIR/bench-report
88+ pushd $BENCH_REPORT_DIR
111 local cmd
89 local cmd
112− cmd="$CABAL_EXECUTABLE install --installdir $SCRIPT_DIR bench-report"
90+ cmd="$CABAL_EXECUTABLE install --installdir bin bench-report"
113 if test "$USE_NIX" -eq 0
91 if test "$USE_NIX" -eq 0
114 then
92 then
115 $cmd || die "bench-report build failed"
93 $cmd || die "bench-report build failed"
@@ -117,7 +95,6 @@ build_report_prog() {
117 nix-shell --run "$cmd" || die "bench-report build failed"
95 nix-shell --run "$cmd" || die "bench-report build failed"
118 fi
96 fi
119 popd
97 popd
120−
121 elif test ! -x "$prog_path"
98 elif test ! -x "$prog_path"
122 then
99 then
123 return 1
100 return 1
@@ -130,8 +107,8 @@ build_report_progs() {
130 then
107 then
131 build_report_prog || exit 1
108 build_report_prog || exit 1
132 local prog
109 local prog
133− prog=$(find_report_prog) || \
110+ prog=$BENCH_REPORT_DIR/bin/bench-report
134− die "Cannot find bench-report executable"
111+ test -x $prog || die "Cannot find bench-report executable"
135 echo "Using bench-report executable [$prog]"
112 echo "Using bench-report executable [$prog]"
136 fi
113 fi
137}
114}
@@ -426,8 +403,8 @@ run_measurements() {
426
403
427run_reports() {
404run_reports() {
428 local prog
405 local prog
429− prog=$(find_report_prog) || \
406+ prog=$BENCH_REPORT_DIR/bin/bench-report
430− die "Cannot find bench-graph executable"
407+ test -x $prog || die "Cannot find bench-report executable"
431 echo
408 echo
432
409
433 for i in $1
410 for i in $1
@@ -445,8 +422,6 @@ run_reports() {
445# Execution starts here
422# Execution starts here
446#-----------------------------------------------------------------------------
423#-----------------------------------------------------------------------------
447
424
448−cd $SCRIPT_DIR/..
449−
450USE_GIT_CABAL=1 # This is used by set_common_vars
425USE_GIT_CABAL=1 # This is used by set_common_vars
451set_common_vars
426set_common_vars
452
427
bin/bench-config.sh+1−1
@@ -2,7 +2,7 @@
2
2
3# Customization options
3# Customization options
4bench_config () {
4bench_config () {
5− BENCHMARK_DIR=benchmark
5+ BENCH_REPORT_DIR=benchmark/bench-report
6 BENCHMARK_PACKAGE_NAME=streamly-benchmarks
6 BENCHMARK_PACKAGE_NAME=streamly-benchmarks
7 BENCHMARK_PACKAGE_VERSION=0.0.0
7 BENCHMARK_PACKAGE_VERSION=0.0.0
8
8
bin/bench.sh+13−1
@@ -1,3 +1,15 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3+SCRIPT_DIR=$(cd `dirname $0`; pwd)
4+source $SCRIPT_DIR/bench-config.sh \
5+ || { echo "Cannot source $SCRIPT_DIR/bench-config.sh"; exit 1; }
6+
7+bench_config
8+if test -z "$BENCH_REPORT_DIR"
9+then
10+ echo "BENCH_REPORT_DIR variable not defined by bench-config() in $SCRIPT_DIR/bench-config.sh"
11+ exit 1
12+fi
13+
14+cd $SCRIPT_DIR/..
3−bin/bench-runner.sh --config bin/bench-config.sh "$@"
15+$BENCH_REPORT_DIR/bin/bench-runner.sh --config $SCRIPT_DIR/bench-config.sh "$@"
streamly.cabal+2−2
@@ -62,6 +62,8 @@ extra-source-files:
62 benchmark/README.md
62 benchmark/README.md
63 benchmark/bench-report/BenchReport.hs
63 benchmark/bench-report/BenchReport.hs
64 benchmark/bench-report/bench-report.cabal
64 benchmark/bench-report/bench-report.cabal
65+ benchmark/bench-report/bin/bench-runner.sh
66+ benchmark/bench-report/bin/build-lib.sh
65 benchmark/bench-report/cabal.project
67 benchmark/bench-report/cabal.project
66 benchmark/bench-report/default.nix
68 benchmark/bench-report/default.nix
67 benchmark/Streamly/Benchmark/Data/*.hs
69 benchmark/Streamly/Benchmark/Data/*.hs
@@ -78,8 +80,6 @@ extra-source-files:
78 benchmark/streamly-benchmarks.cabal
80 benchmark/streamly-benchmarks.cabal
79 bin/bench.sh
81 bin/bench.sh
80 bin/bench-config.sh
82 bin/bench-config.sh
81− bin/bench-runner.sh
82− bin/build-lib.sh
83 bin/ghc.sh
83 bin/ghc.sh
84 bin/run-ci.sh
84 bin/run-ci.sh
85 bin/mk-hscope.sh
85 bin/mk-hscope.sh