on master help sign in
update missing benchmarks, support benchmark groups
2604246Harendra Kumar
bench.sh+43−10
@@ -1,10 +1,27 @@
1#!/bin/bash
1#!/bin/bash
2
2
3+DEV_BENCHMARKS="concurrent base adaptive"
3−ALL_BENCHMARKS="linear linear-async linear-rate nested nested-concurrent nested-unfold concurrent fileio array base"
4+SERIAL_BENCHMARKS="linear linear-rate nested nested-unfold"
5+# parallel benchmark-suite is separated because we run it with a higher
6+# heap size limit.
7+CONCURRENT_BENCHMARKS="linear-async nested-concurrent parallel"
8+ARRAY_BENCHMARKS="array unpinned-array prim-array small-array"
9+
10+INFINITE_BENCHMARKS="$SERIAL_BENCHMARKS linear-async nested-concurrent"
11+FINITE_BENCHMARKS="$ARRAY_BENCHMARKS fileio parallel"
12+
13+ALL_BENCHMARKS="$SERIAL_BENCHMARKS $CONCURRENT_BENCHMARKS $ARRAY_BENCHMARKS $DEV_BENCHMARKS"
14+
15+list_benches () {
16+ for i in $ALL_BENCHMARKS
17+ do
18+ echo -n "|$i"
19+ done
20+}
4
21
5print_help () {
22print_help () {
6 echo "Usage: $0 "
23 echo "Usage: $0 "
7− echo " [--benchmarks <all|linear|linear-async|linear-rate|nested|nested-concurrent|nested-unfold|concurrent|fileio|array|base>]"
24+ echo " [--benchmarks <ALL|SERIAL|CONCURRENT|ARRAY|INFINITE|FINITE|DEV$(list_benches)>]"
8 echo " [--group-diff]"
25 echo " [--group-diff]"
9 echo " [--graphs]"
26 echo " [--graphs]"
10 echo " [--no-measure]"
27 echo " [--no-measure]"
@@ -14,9 +31,9 @@ print_help () {
14 echo " [--quick]"
31 echo " [--quick]"
15 echo " [--compare] [--base commit] [--candidate commit]"
32 echo " [--compare] [--base commit] [--candidate commit]"
16 echo " [--cabal-build-flags]"
33 echo " [--cabal-build-flags]"
17− echo " -- <gauge options>"
34+ echo " -- <gauge options or benchmarks>"
18 echo
35 echo
19− echo "Multiple benchmarks can be specified as a space separate list"
36+ echo "Multiple benchmarks can be specified as a space separated list"
20 echo " e.g. --benchmarks \"linear nested\""
37 echo " e.g. --benchmarks \"linear nested\""
21 echo
38 echo
22 echo "--group-diff is used to compare groups within a single benchmark"
39 echo "--group-diff is used to compare groups within a single benchmark"
@@ -39,12 +56,23 @@ die () {
39set_benchmarks() {
56set_benchmarks() {
40 if test -z "$BENCHMARKS"
57 if test -z "$BENCHMARKS"
41 then
58 then
42− BENCHMARKS=$DEFAULT_BENCHMARKS
59+ echo $DEFAULT_BENCHMARKS
60+ else
43− elif test "$BENCHMARKS" = "all"
61+ for i in $(echo $BENCHMARKS)
44− then
62+ do
63+ case $i in
45− BENCHMARKS=$ALL_BENCHMARKS
64+ ALL) echo -n $ALL_BENCHMARKS ;;
65+ DEV) echo -n $DEV_BENCHMARKS ;;
66+ SERIAL) echo -n $SERIAL_BENCHMARKS ;;
67+ CONCURRENT) echo -n $CONCURRENT_BENCHMARKS ;;
68+ ARRAY) echo -n $ARRAY_BENCHMARKS ;;
69+ INFINITE) echo -n $INFINITE_BENCHMARKS ;;
70+ FINITE) echo -n $FINITE_BENCHMARKS ;;
71+ *) echo -n $i ;;
72+ esac
73+ echo -n " "
74+ done
46 fi
75 fi
47− echo "Using benchmark suites [$BENCHMARKS]"
48}
76}
49
77
50# $1: benchmark name (linear, nested, base)
78# $1: benchmark name (linear, nested, base)
@@ -313,7 +341,12 @@ done
313GAUGE_ARGS=$*
341GAUGE_ARGS=$*
314
342
315echo "Using stack command [$STACK]"
343echo "Using stack command [$STACK]"
316−set_benchmarks
344+BENCHMARKS=$(set_benchmarks)
345+if test "$LONG" -ne 0
346+then
347+ BENCHMARKS=$INFINITE_BENCHMARKS
348+fi
349+echo "Using benchmark suites [$BENCHMARKS]"
317
350
318# XXX we can remove these if we pass stack build flags from command line like
351# XXX we can remove these if we pass stack build flags from command line like
319# cabal build flags.
352# cabal build flags.
benchmark/Chart.hs+32−4
@@ -32,7 +32,11 @@ data BenchType
32 | Base
32 | Base
33 | FileIO
33 | FileIO
34 | Array
34 | Array
35+ | UnpinnedArray
36+ | SmallArray
37+ | PrimArray
35 | Concurrent
38 | Concurrent
39+ | Parallel
36 deriving Show
40 deriving Show
37
41
38data Options = Options
42data Options = Options
@@ -76,7 +80,11 @@ parseBench = do
76 Just "base" -> setBenchType Base
80 Just "base" -> setBenchType Base
77 Just "fileio" -> setBenchType FileIO
81 Just "fileio" -> setBenchType FileIO
78 Just "array" -> setBenchType Array
82 Just "array" -> setBenchType Array
83+ Just "unpinned-array" -> setBenchType UnpinnedArray
84+ Just "small-array" -> setBenchType SmallArray
85+ Just "prim-array" -> setBenchType PrimArray
79 Just "concurrent" -> setBenchType Concurrent
86 Just "concurrent" -> setBenchType Concurrent
87+ Just "parallel" -> setBenchType Parallel
80 Just str -> do
88 Just str -> do
81 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
89 liftIO $ putStrLn $ "unrecognized benchmark type " <> str
82 mzero
90 mzero
@@ -247,9 +255,9 @@ makeFileIOGraphs :: Config -> String -> IO ()
247makeFileIOGraphs cfg@Config{..} inputFile =
255makeFileIOGraphs cfg@Config{..} inputFile =
248 ignoringErr $ graph inputFile "fileIO" cfg
256 ignoringErr $ graph inputFile "fileIO" cfg
249
257
250−makeArrayGraphs :: Config -> String -> IO ()
258+makeGraphs :: String -> Config -> String -> IO ()
251−makeArrayGraphs cfg@Config{..} inputFile =
259+makeGraphs name cfg@Config{..} inputFile =
252− ignoringErr $ graph inputFile "array" cfg
260+ ignoringErr $ graph inputFile name cfg
253
261
254makeConcurrentGraphs :: Config -> String -> IO ()
262makeConcurrentGraphs :: Config -> String -> IO ()
255makeConcurrentGraphs cfg@Config{..} inputFile =
263makeConcurrentGraphs cfg@Config{..} inputFile =
@@ -370,14 +378,34 @@ main = do
370 "charts/fileio"
378 "charts/fileio"
371 Array -> benchShow opts cfg
379 Array -> benchShow opts cfg
372 { title = Just "Array" }
380 { title = Just "Array" }
373− makeArrayGraphs
381+ (makeGraphs "array")
374 "charts/array/results.csv"
382 "charts/array/results.csv"
375 "charts/array"
383 "charts/array"
384+ UnpinnedArray -> benchShow opts cfg
385+ { title = Just "Unpinned Array" }
386+ (makeGraphs "unpinned-array")
387+ "charts/unpinned-array/results.csv"
388+ "charts/unpinned-array"
389+ SmallArray -> benchShow opts cfg
390+ { title = Just "Small Array" }
391+ (makeGraphs "small-array")
392+ "charts/small-array/results.csv"
393+ "charts/small-array"
394+ PrimArray -> benchShow opts cfg
395+ { title = Just "Prim Array" }
396+ (makeGraphs "prim-array")
397+ "charts/prim-array/results.csv"
398+ "charts/prim-array"
376 Concurrent -> benchShow opts cfg
399 Concurrent -> benchShow opts cfg
377 { title = Just "Concurrent Ops" }
400 { title = Just "Concurrent Ops" }
378 makeConcurrentGraphs
401 makeConcurrentGraphs
379 "charts/concurrent/results.csv"
402 "charts/concurrent/results.csv"
380 "charts/concurrent"
403 "charts/concurrent"
404+ Parallel -> benchShow opts cfg
405+ { title = Just "Parallel" }
406+ (makeGraphs "parallel")
407+ "charts/parallel/results.csv"
408+ "charts/parallel"
381 Base -> do
409 Base -> do
382 let cfg' = cfg { title = Just "Base stream" }
410 let cfg' = cfg { title = Just "Base stream" }
383 if groupDiff
411 if groupDiff