diff options
author | Sibi Prabakaran <sibi@psibi.in> | 2020-06-14 09:46:47 +0530 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-06-23 16:38:20 +0100 |
commit | b4f0f35ef118064bc7829b6224a896b448a37bc4 (patch) | |
tree | ccee394fdd32d6bb4d65bf21648cab3b00274883 /bench/main.hs | |
parent | 2b13b5cf6595d81280c95eb9cf507a9817e3f641 (diff) | |
download | xmobar-b4f0f35ef118064bc7829b6224a896b448a37bc4.tar.gz xmobar-b4f0f35ef118064bc7829b6224a896b448a37bc4.tar.bz2 |
Optimize CPU monitor
Diffstat (limited to 'bench/main.hs')
-rw-r--r-- | bench/main.hs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/bench/main.hs b/bench/main.hs index 205acc8..b6f4c1a 100644 --- a/bench/main.hs +++ b/bench/main.hs @@ -18,24 +18,12 @@ main = do runMonitor :: MConfig -> Monitor a -> IO a runMonitor config r = runReaderT r config -data CpuArguments = CpuArguments { - cpuRef :: CpuDataRef, - cpuMConfig :: MConfig, - cpuArgs :: [String] - } - mkCpuArgs :: IO CpuArguments -mkCpuArgs = do - cpuRef <- newIORef [] - _ <- parseCpu cpuRef - cpuMConfig <- cpuConfig - let cpuArgs = ["-L","3","-H","50","--normal","green","--high","red"] - pure $ 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 CpuArguments{..} = runMonitor cpuMConfig (doArgs cpuArgs (runCpu cpuRef) (\_ -> return True)) - +cpuAction = runCpu cpuBenchmark :: CpuArguments -> Benchmarkable cpuBenchmark cpuParams = nfIO $ cpuAction cpuParams |