on master help sign in
Add "concurrent" benchmark to charting/bench-show
1266a13Harendra Kumar
bench.sh+24−17
@@ -2,7 +2,7 @@
2
2
3print_help () {
3print_help () {
4 echo "Usage: $0 "
4 echo "Usage: $0 "
5− echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|fileio|array|base>]"
5+ echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|concurrent|fileio|array|base>]"
6 echo " [--group-diff]"
6 echo " [--group-diff]"
7 echo " [--graphs]"
7 echo " [--graphs]"
8 echo " [--no-measure]"
8 echo " [--no-measure]"
@@ -231,7 +231,7 @@ run_reports() {
231#-----------------------------------------------------------------------------
231#-----------------------------------------------------------------------------
232
232
233DEFAULT_BENCHMARKS="linear"
233DEFAULT_BENCHMARKS="linear"
234−ALL_BENCHMARKS="linear linear-async linear-rate nested fileio array base"
234+ALL_BENCHMARKS="linear linear-async linear-rate nested concurrrent fileio array base"
235GROUP_DIFF=0
235GROUP_DIFF=0
236
236
237COMPARE=0
237COMPARE=0
@@ -254,21 +254,6 @@ cabal_which() {
254 find dist-newstyle -type f -path "*${GHC_VERSION}*/$1"
254 find dist-newstyle -type f -path "*${GHC_VERSION}*/$1"
255}
255}
256
256
257−if test "$USE_STACK" = "1"
258−then
259− WHICH_COMMAND="stack exec which"
260− BUILD_CHART_EXE="stack build --flag streamly:dev"
261− GET_BENCH_PROG=stack_bench_prog
262− BUILD_BENCH="stack build $STACK_BUILD_FLAGS --flags "streamly:benchmark" --bench --no-run-benchmarks"
263−else
264− # XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
265− #WHICH_COMMAND="cabal v2-exec which"
266− WHICH_COMMAND=cabal_which
267− BUILD_CHART_EXE="cabal v2-build --flags dev chart"
268− GET_BENCH_PROG=cabal_bench_prog
269− BUILD_BENCH="cabal v2-build $CABAL_BUILD_FLAGS --flag benchmark --enable-benchmarks"
270−fi
271−
272#-----------------------------------------------------------------------------
257#-----------------------------------------------------------------------------
273# Read command line
258# Read command line
274#-----------------------------------------------------------------------------
259#-----------------------------------------------------------------------------
@@ -305,6 +290,27 @@ then
305 CABAL_BUILD_FLAGS="--flags dev"
290 CABAL_BUILD_FLAGS="--flags dev"
306fi
291fi
307
292
293+if echo "$BENCHMARKS" | grep -q concurrent
294+then
295+ STACK_BUILD_FLAGS="--flag streamly:dev"
296+ CABAL_BUILD_FLAGS="--flags dev"
297+fi
298+
299+if test "$USE_STACK" = "1"
300+then
301+ WHICH_COMMAND="stack exec which"
302+ BUILD_CHART_EXE="stack build --flag streamly:dev"
303+ GET_BENCH_PROG=stack_bench_prog
304+ BUILD_BENCH="stack build $STACK_BUILD_FLAGS --flags "streamly:benchmark" --bench --no-run-benchmarks"
305+else
306+ # XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
307+ #WHICH_COMMAND="cabal v2-exec which"
308+ WHICH_COMMAND=cabal_which
309+ BUILD_CHART_EXE="cabal v2-build --flags dev chart"
310+ GET_BENCH_PROG=cabal_bench_prog
311+ BUILD_BENCH="cabal v2-build $CABAL_BUILD_FLAGS --flag benchmark --enable-benchmarks"
312+fi
313+
308#-----------------------------------------------------------------------------
314#-----------------------------------------------------------------------------
309# Build stuff
315# Build stuff
310#-----------------------------------------------------------------------------
316#-----------------------------------------------------------------------------
@@ -319,6 +325,7 @@ build_report_progs "$BENCHMARKS"
319
325
320if test "$MEASURE" = "1"
326if test "$MEASURE" = "1"
321then
327then
328+ echo $BUILD_BENCH
322 $BUILD_BENCH || die "build failed"
329 $BUILD_BENCH || die "build failed"
323 run_measurements "$BENCHMARKS"
330 run_measurements "$BENCHMARKS"
324fi
331fi
benchmark/Chart.hs+11
@@ -30,6 +30,7 @@ data BenchType
30 | Base
30 | Base
31 | FileIO
31 | FileIO
32 | Array
32 | Array
33+ | Concurrent
33 deriving Show
34 deriving Show
34
35
35data Options = Options
36data Options = Options
@@ -71,6 +72,7 @@ parseBench = do
71 Just "base" -> setBenchType Base
72 Just "base" -> setBenchType Base
72 Just "fileio" -> setBenchType FileIO
73 Just "fileio" -> setBenchType FileIO
73 Just "array" -> setBenchType Array
74 Just "array" -> setBenchType Array
75+ Just "concurrent" -> setBenchType Concurrent
74 Just str -> do
76 Just str -> do
75 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
77 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
76 mzero
78 mzero
@@ -245,6 +247,10 @@ makeArrayGraphs :: Config -> String -> IO ()
245makeArrayGraphs cfg@Config{..} inputFile =
247makeArrayGraphs cfg@Config{..} inputFile =
246 ignoringErr $ graph inputFile "array" cfg
248 ignoringErr $ graph inputFile "array" cfg
247
249
250+makeConcurrentGraphs :: Config -> String -> IO ()
251+makeConcurrentGraphs cfg@Config{..} inputFile =
252+ ignoringErr $ graph inputFile "concurrent" cfg
253+
248------------------------------------------------------------------------------
254------------------------------------------------------------------------------
249-- Reports/Charts for base streams
255-- Reports/Charts for base streams
250------------------------------------------------------------------------------
256------------------------------------------------------------------------------
@@ -353,6 +359,11 @@ main = do
353 makeArrayGraphs
359 makeArrayGraphs
354 "charts/array/results.csv"
360 "charts/array/results.csv"
355 "charts/array"
361 "charts/array"
362+ Concurrent -> benchShow opts cfg
363+ { title = Just "Concurrent Ops" }
364+ makeConcurrentGraphs
365+ "charts/concurrent/results.csv"
366+ "charts/concurrent"
356 Base -> do
367 Base -> do
357 let cfg' = cfg { title = Just "100,000 elems" }
368 let cfg' = cfg { title = Just "100,000 elems" }
358 if groupDiff
369 if groupDiff