diff options
Diffstat (limited to 'bench/main.hs')
-rw-r--r-- | bench/main.hs | 31 |
1 files changed, 9 insertions, 22 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) + ] |