diff options
author | Tomas Janousek <tomi@nomi.cz> | 2020-11-12 09:33:25 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-11-13 02:10:31 +0000 |
commit | e47cb0222eb5b152f69a18f4685726a5460f4b90 (patch) | |
tree | 85da104f1276c7590d810d423b501b350b91503e /bench/main.hs | |
parent | 0daf131e44c0f3debd5ca5fc5b467ceab256633f (diff) | |
download | xmobar-e47cb0222eb5b152f69a18f4685726a5460f4b90.tar.gz xmobar-e47cb0222eb5b152f69a18f4685726a5460f4b90.tar.bz2 |
bench: Clean up a bit
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) + ] |