summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2020-11-12 09:33:25 +0000
committerjao <jao@gnu.org>2020-11-13 02:10:31 +0000
commite47cb0222eb5b152f69a18f4685726a5460f4b90 (patch)
tree85da104f1276c7590d810d423b501b350b91503e
parent0daf131e44c0f3debd5ca5fc5b467ceab256633f (diff)
downloadxmobar-e47cb0222eb5b152f69a18f4685726a5460f4b90.tar.gz
xmobar-e47cb0222eb5b152f69a18f4685726a5460f4b90.tar.bz2
bench: Clean up a bit
-rw-r--r--bench/main.hs31
-rw-r--r--xmobar.cabal2
2 files changed, 10 insertions, 23 deletions
diff --git a/bench/main.hs b/bench/main.hs
index b6f4c1a..f8db78c 100644
--- a/bench/main.hs
+++ b/bench/main.hs
@@ -1,32 +1,19 @@
-{-#LANGUAGE RecordWildCards#-}
+module Main (main) where
import Gauge
import Xmobar
-import Xmobar.Plugins.Monitors.Common.Types
-import Xmobar.Plugins.Monitors.Common.Run
import Xmobar.Plugins.Monitors.Cpu
-import Control.Monad.Reader
-import Data.IORef (newIORef)
main :: IO ()
main = do
- cpuParams <- mkCpuArgs
- defaultMain $ normalBench cpuParams
- where
- normalBench args = [ bgroup "Cpu Benchmarks" $ normalCpuBench args]
-
-runMonitor :: MConfig -> Monitor a -> IO a
-runMonitor config r = runReaderT r config
+ defaultMain =<< sequence [cpuBench]
mkCpuArgs :: IO CpuArguments
-mkCpuArgs = getArguments ["-L","3","-H","50","--normal","green","--high","red", "-t", "Cpu: <total>%"]
-
--- | The action which will be benchmarked
-cpuAction :: CpuArguments -> IO String
-cpuAction = runCpu
-
-cpuBenchmark :: CpuArguments -> Benchmarkable
-cpuBenchmark cpuParams = nfIO $ cpuAction cpuParams
+mkCpuArgs = getArguments ["-L", "3", "-H", "50", "--normal", "green", "--high", "red", "-t", "Cpu: <total>%"]
-normalCpuBench :: CpuArguments -> [Benchmark]
-normalCpuBench args = [bench "CPU normal args" (cpuBenchmark args)]
+cpuBench :: IO Benchmark
+cpuBench = do
+ cpuArgs <- mkCpuArgs
+ return $ bgroup "Cpu Benchmarks"
+ [ bench "CPU normal args" $ nfIO (runCpu cpuArgs)
+ ]
diff --git a/xmobar.cabal b/xmobar.cabal
index 92f257b..57dfcb9 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -356,6 +356,6 @@ benchmark xmobarbench
main-is: main.hs
hs-source-dirs:
bench
- ghc-options: -O2
+ ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -O2
build-depends: base, gauge, xmobar, mtl
default-language: Haskell2010