@@ -18,9 +18,7 @@
1818{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
1919#endif
2020
21−module Serial.Exceptions
22− (allBenchmarks)
23−where
21+module Serial.Exceptions (benchmarks) where
2422
2523import Control.Exception (SomeException)
2624import System.IO (Handle, hClose, hPutChar)
@@ -33,7 +31,8 @@ import qualified Streamly.Prelude as S
3331
3432import Gauge hiding (env)
3533import Prelude hiding (last, length)
36−import Streamly.Benchmark.CommonH
34+import Streamly.Benchmark.Common
35+import Streamly.Benchmark.Common.Handle
3736
3837#ifdef INSPECTION
3938import Test.Inspection
@@ -104,7 +103,7 @@ readWriteAfter_Stream inh devNull =
104103
105104o_1_space_copy_stream_exceptions :: BenchEnv -> [Benchmark]
106105o_1_space_copy_stream_exceptions env =
107− [ bgroup "copy/read/exceptions"
106+ [ bgroup "exceptions"
108107 [ mkBenchSmall "S.onException" env $ \inh _ ->
109108 readWriteOnExceptionStream inh (nullH env)
110109 , mkBenchSmall "S.handle" env $ \inh _ ->
@@ -120,7 +119,7 @@ o_1_space_copy_stream_exceptions env =
120119 , mkBenchSmall "S.after_" env $ \inh _ ->
121120 readWriteAfter_Stream inh (nullH env)
122121 ]
123− , bgroup "copy/fromToBytes/exceptions"
122+ , bgroup "exceptions/fromToBytes"
124123 [ mkBenchSmall "S.bracket_" env $ \inh _ ->
125124 fromToBytesBracket_Stream inh (nullH env)
126125 , mkBenchSmall "S.bracket" env $ \inh _ ->
@@ -161,7 +160,7 @@ readChunksBracket inh devNull =
161160
162161o_1_space_copy_exceptions_readChunks :: BenchEnv -> [Benchmark]
163162o_1_space_copy_exceptions_readChunks env =
164− [ bgroup "copy/readChunks/exceptions"
163+ [ bgroup "exceptions/readChunks"
165164 [ mkBench "UF.onException" env $ \inH _ ->
166165 readChunksOnException inH (nullH env)
167166 , mkBench "UF.bracket_" env $ \inH _ ->
@@ -199,7 +198,7 @@ toChunksBracket inh devNull =
199198
200199o_1_space_copy_exceptions_toChunks :: BenchEnv -> [Benchmark]
201200o_1_space_copy_exceptions_toChunks env =
202− [ bgroup "copy/toChunks/exceptions"
201+ [ bgroup "exceptions/toChunks"
203202 [ mkBench "S.bracket_" env $ \inH _ ->
204203 toChunksBracket_ inH (nullH env)
205204 , mkBench "S.bracket" env $ \inH _ ->
@@ -208,9 +207,11 @@ o_1_space_copy_exceptions_toChunks env =
208207 ]
209208
210209
211−allBenchmarks :: BenchEnv -> [Benchmark]
212−allBenchmarks env = Prelude.concat
213− [ o_1_space_copy_exceptions_readChunks env
214− , o_1_space_copy_exceptions_toChunks env
215− , o_1_space_copy_stream_exceptions env
216− ]
210+benchmarks :: String -> BenchEnv -> [Benchmark]
211+benchmarks moduleName env =
212+ [ bgroup (o_1_space_prefix moduleName) $ concat
213+ [ o_1_space_copy_exceptions_readChunks env
214+ , o_1_space_copy_exceptions_toChunks env
215+ , o_1_space_copy_stream_exceptions env
216+ ]
217+ ]