diff options
-rw-r--r-- | bench/main.hs | 31 | ||||
-rw-r--r-- | xmobar.cabal | 2 |
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 |