Move benchmark to ekg-core
This commit is contained in:
parent
e74133eb70
commit
88996a4157
2 changed files with 0 additions and 35 deletions
|
@ -1,24 +0,0 @@
|
|||
{-# LANGUAGE BangPatterns, OverloadedStrings #-}
|
||||
|
||||
-- | Perform 100,000 atomic increments using 100 concurrent writers.
|
||||
module Main where
|
||||
|
||||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
import System.Remote.Counter
|
||||
import System.Remote.Monitoring
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
handle <- forkServer "localhost" 8000
|
||||
counter <- getCounter "iterations" handle
|
||||
locks <- replicateM n newEmptyMVar
|
||||
mapM_ (forkIO . work counter iters) locks
|
||||
mapM_ takeMVar locks
|
||||
where
|
||||
n = 100
|
||||
iters = 100000
|
||||
|
||||
work :: Counter -> Int -> MVar () -> IO ()
|
||||
work !_ 0 !lock = putMVar lock ()
|
||||
work counter i lock = inc counter >> work counter (i - 1) lock
|
11
ekg.cabal
11
ekg.cabal
|
@ -52,17 +52,6 @@ library
|
|||
|
||||
ghc-options: -Wall
|
||||
|
||||
benchmark benchmarks
|
||||
hs-source-dirs: benchmarks
|
||||
main-is: Benchmarks.hs
|
||||
type: exitcode-stdio-1.0
|
||||
|
||||
build-depends:
|
||||
base,
|
||||
ekg
|
||||
|
||||
ghc-options: -O2 -threaded -Wall
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: https://github.com/tibbe/ekg.git
|
||||
|
|
Loading…
Reference in a new issue