1{-# LANGUAGE BangPatterns #-}
3-- | Like Throughput, but send every ping from a different process
4-- (i.e., require a lightweight connection per ping)
5import System.Environment
7import Control.Applicative
8import Control.Distributed.Process
9import Control.Distributed.Process.Node
10import Network.Transport.TCP (createTransport, defaultTCPAddr, defaultTCPParameters)
11import Data.Binary (encode, decode)
12import qualified Data.ByteString.Lazy as BSL
17 go :: Int -> Process ()
22 Just them -> send them n >> go 0
24count :: Int -> ProcessId -> Process ()
27 replicateM_ n . spawnLocal $ send them (Nothing :: Maybe ProcessId)
30 liftIO $ print (n == n')
32initialProcess :: String -> Process ()
33initialProcess "SERVER" = do
35 liftIO $ BSL.writeFile "counter.pid" (encode us)
37initialProcess "CLIENT" = do
39 them <- liftIO $ decode <$> BSL.readFile "counter.pid"
44 [role, host, port] <- getArgs
45 trans <- createTransport (defaultTCPAddr host port) defaultTCPParameters
47 Right transport -> do node <- newLocalNode transport initRemoteTable
48 runProcess node $ initialProcess role
49 Left other -> error $ show other
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list