module Simulation.Aivika.Server
(
Server,
newServer,
newStateServer,
newPreemptibleServer,
newPreemptibleStateServer,
serverProcessor,
serverInitState,
serverState,
serverTotalInputWaitTime,
serverTotalProcessingTime,
serverTotalOutputWaitTime,
serverTotalPreemptionTime,
serverInputWaitTime,
serverProcessingTime,
serverOutputWaitTime,
serverPreemptionTime,
serverInputWaitFactor,
serverProcessingFactor,
serverOutputWaitFactor,
serverPreemptionFactor,
resetServer,
serverSummary,
serverStateChanged,
serverStateChanged_,
serverTotalInputWaitTimeChanged,
serverTotalInputWaitTimeChanged_,
serverTotalProcessingTimeChanged,
serverTotalProcessingTimeChanged_,
serverTotalOutputWaitTimeChanged,
serverTotalOutputWaitTimeChanged_,
serverTotalPreemptionTimeChanged,
serverTotalPreemptionTimeChanged_,
serverInputWaitTimeChanged,
serverInputWaitTimeChanged_,
serverProcessingTimeChanged,
serverProcessingTimeChanged_,
serverOutputWaitTimeChanged,
serverOutputWaitTimeChanged_,
serverPreemptionTimeChanged,
serverPreemptionTimeChanged_,
serverInputWaitFactorChanged,
serverInputWaitFactorChanged_,
serverProcessingFactorChanged,
serverProcessingFactorChanged_,
serverOutputWaitFactorChanged,
serverOutputWaitFactorChanged_,
serverPreemptionFactorChanged,
serverPreemptionFactorChanged_,
serverInputReceived,
serverTaskPreemptionBeginning,
serverTaskPreemptionEnding,
serverTaskProcessed,
serverOutputProvided,
serverChanged_) where
import Data.IORef
import Data.Monoid
import Control.Monad
import Control.Monad.Trans
import Control.Arrow
import Simulation.Aivika.Simulation
import Simulation.Aivika.Dynamics
import Simulation.Aivika.Internal.Event
import Simulation.Aivika.Signal
import Simulation.Aivika.Cont
import Simulation.Aivika.Process
import Simulation.Aivika.Processor
import Simulation.Aivika.Stream
import Simulation.Aivika.Statistics
data Server s a b =
Server { forall s a b. Server s a b -> s
serverInitState :: s,
forall s a b. Server s a b -> IORef s
serverStateRef :: IORef s,
forall s a b. Server s a b -> s -> a -> Process (s, b)
serverProcess :: s -> a -> Process (s, b),
forall s a b. Server s a b -> Bool
serverProcessPreemptible :: Bool,
forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef :: IORef Double,
forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef :: IORef Double,
forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef :: IORef Double,
forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef :: IORef Double,
forall s a b. Server s a b -> IORef (SamplingStats Double)
serverInputWaitTimeRef :: IORef (SamplingStats Double),
forall s a b. Server s a b -> IORef (SamplingStats Double)
serverProcessingTimeRef :: IORef (SamplingStats Double),
forall s a b. Server s a b -> IORef (SamplingStats Double)
serverOutputWaitTimeRef :: IORef (SamplingStats Double),
forall s a b. Server s a b -> IORef (SamplingStats Double)
serverPreemptionTimeRef :: IORef (SamplingStats Double),
forall s a b. Server s a b -> SignalSource a
serverInputReceivedSource :: SignalSource a,
forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionBeginningSource :: SignalSource a,
forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionEndingSource :: SignalSource a,
forall s a b. Server s a b -> SignalSource (a, b)
serverTaskProcessedSource :: SignalSource (a, b),
forall s a b. Server s a b -> SignalSource (a, b)
serverOutputProvidedSource :: SignalSource (a, b)
}
newServer :: (a -> Process b)
-> Simulation (Server () a b)
newServer :: forall a b. (a -> Process b) -> Simulation (Server () a b)
newServer = forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
False
newStateServer :: (s -> a -> Process (s, b))
-> s
-> Simulation (Server s a b)
newStateServer :: forall s a b.
(s -> a -> Process (s, b)) -> s -> Simulation (Server s a b)
newStateServer = forall s a b.
Bool
-> (s -> a -> Process (s, b)) -> s -> Simulation (Server s a b)
newPreemptibleStateServer Bool
False
newPreemptibleServer :: Bool
-> (a -> Process b)
-> Simulation (Server () a b)
newPreemptibleServer :: forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible a -> Process b
provide =
forall a b c. (a -> b -> c) -> b -> a -> c
flip (forall s a b.
Bool
-> (s -> a -> Process (s, b)) -> s -> Simulation (Server s a b)
newPreemptibleStateServer Bool
preemptible) () forall a b. (a -> b) -> a -> b
$ \()
s a
a ->
do b
b <- a -> Process b
provide a
a
forall (m :: * -> *) a. Monad m => a -> m a
return (()
s, b
b)
newPreemptibleStateServer :: Bool
-> (s -> a -> Process (s, b))
-> s
-> Simulation (Server s a b)
newPreemptibleStateServer :: forall s a b.
Bool
-> (s -> a -> Process (s, b)) -> s -> Simulation (Server s a b)
newPreemptibleStateServer Bool
preemptible s -> a -> Process (s, b)
provide s
state =
do IORef s
r0 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef s
state
IORef Double
r1 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
0
IORef Double
r2 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
0
IORef Double
r3 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
0
IORef Double
r4 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
0
IORef (SamplingStats Double)
r5 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef forall a. SamplingData a => SamplingStats a
emptySamplingStats
IORef (SamplingStats Double)
r6 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef forall a. SamplingData a => SamplingStats a
emptySamplingStats
IORef (SamplingStats Double)
r7 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef forall a. SamplingData a => SamplingStats a
emptySamplingStats
IORef (SamplingStats Double)
r8 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef forall a. SamplingData a => SamplingStats a
emptySamplingStats
SignalSource a
s1 <- forall a. Simulation (SignalSource a)
newSignalSource
SignalSource a
s2 <- forall a. Simulation (SignalSource a)
newSignalSource
SignalSource a
s3 <- forall a. Simulation (SignalSource a)
newSignalSource
SignalSource (a, b)
s4 <- forall a. Simulation (SignalSource a)
newSignalSource
SignalSource (a, b)
s5 <- forall a. Simulation (SignalSource a)
newSignalSource
let server :: Server s a b
server = Server { serverInitState :: s
serverInitState = s
state,
serverStateRef :: IORef s
serverStateRef = IORef s
r0,
serverProcess :: s -> a -> Process (s, b)
serverProcess = s -> a -> Process (s, b)
provide,
serverProcessPreemptible :: Bool
serverProcessPreemptible = Bool
preemptible,
serverTotalInputWaitTimeRef :: IORef Double
serverTotalInputWaitTimeRef = IORef Double
r1,
serverTotalProcessingTimeRef :: IORef Double
serverTotalProcessingTimeRef = IORef Double
r2,
serverTotalOutputWaitTimeRef :: IORef Double
serverTotalOutputWaitTimeRef = IORef Double
r3,
serverTotalPreemptionTimeRef :: IORef Double
serverTotalPreemptionTimeRef = IORef Double
r4,
serverInputWaitTimeRef :: IORef (SamplingStats Double)
serverInputWaitTimeRef = IORef (SamplingStats Double)
r5,
serverProcessingTimeRef :: IORef (SamplingStats Double)
serverProcessingTimeRef = IORef (SamplingStats Double)
r6,
serverOutputWaitTimeRef :: IORef (SamplingStats Double)
serverOutputWaitTimeRef = IORef (SamplingStats Double)
r7,
serverPreemptionTimeRef :: IORef (SamplingStats Double)
serverPreemptionTimeRef = IORef (SamplingStats Double)
r8,
serverInputReceivedSource :: SignalSource a
serverInputReceivedSource = SignalSource a
s1,
serverTaskPreemptionBeginningSource :: SignalSource a
serverTaskPreemptionBeginningSource = SignalSource a
s2,
serverTaskPreemptionEndingSource :: SignalSource a
serverTaskPreemptionEndingSource = SignalSource a
s3,
serverTaskProcessedSource :: SignalSource (a, b)
serverTaskProcessedSource = SignalSource (a, b)
s4,
serverOutputProvidedSource :: SignalSource (a, b)
serverOutputProvidedSource = SignalSource (a, b)
s5 }
forall (m :: * -> *) a. Monad m => a -> m a
return Server s a b
server
serverProcessor :: Server s a b -> Processor a b
serverProcessor :: forall s a b. Server s a b -> Processor a b
serverProcessor Server s a b
server =
forall a b. (Stream a -> Stream b) -> Processor a b
Processor forall a b. (a -> b) -> a -> b
$ \Stream a
xs -> s -> Maybe (Double, a, b) -> Stream a -> Stream b
loop (forall s a b. Server s a b -> s
serverInitState Server s a b
server) forall a. Maybe a
Nothing Stream a
xs
where
loop :: s -> Maybe (Double, a, b) -> Stream a -> Stream b
loop s
s Maybe (Double, a, b)
r Stream a
xs =
forall a. Process (a, Stream a) -> Stream a
Cons forall a b. (a -> b) -> a -> b
$
do Double
t0 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
case Maybe (Double, a, b)
r of
Maybe (Double, a, b)
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
Just (Double
t', a
a', b
b') ->
do forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$
do forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server) (forall a. Num a => a -> a -> a
+ (Double
t0 forall a. Num a => a -> a -> a
- Double
t'))
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverOutputWaitTimeRef Server s a b
server) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats (Double
t0 forall a. Num a => a -> a -> a
- Double
t')
forall a. SignalSource a -> a -> Event ()
triggerSignal (forall s a b. Server s a b -> SignalSource (a, b)
serverOutputProvidedSource Server s a b
server) (a
a', b
b')
(a
a, Stream a
xs') <- forall a. Stream a -> Process (a, Stream a)
runStream Stream a
xs
Double
t1 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
do forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$
do forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server) (forall a. Num a => a -> a -> a
+ (Double
t1 forall a. Num a => a -> a -> a
- Double
t0))
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverInputWaitTimeRef Server s a b
server) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats (Double
t1 forall a. Num a => a -> a -> a
- Double
t0)
forall a. SignalSource a -> a -> Event ()
triggerSignal (forall s a b. Server s a b -> SignalSource a
serverInputReceivedSource Server s a b
server) a
a
(s
s', b
b, Double
dt) <-
if forall s a b. Server s a b -> Bool
serverProcessPreemptible Server s a b
server
then forall s a b. Server s a b -> s -> a -> Process (s, b, Double)
serverProcessPreempting Server s a b
server s
s a
a
else do (s
s', b
b) <- forall s a b. Server s a b -> s -> a -> Process (s, b)
serverProcess Server s a b
server s
s a
a
forall (m :: * -> *) a. Monad m => a -> m a
return (s
s', b
b, Double
0)
Double
t2 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
do forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$
do forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef s
serverStateRef Server s a b
server) forall a b. (a -> b) -> a -> b
$! s
s'
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server) (forall a. Num a => a -> a -> a
+ (Double
t2 forall a. Num a => a -> a -> a
- Double
t1 forall a. Num a => a -> a -> a
- Double
dt))
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverProcessingTimeRef Server s a b
server) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats (Double
t2 forall a. Num a => a -> a -> a
- Double
t1 forall a. Num a => a -> a -> a
- Double
dt)
forall a. SignalSource a -> a -> Event ()
triggerSignal (forall s a b. Server s a b -> SignalSource (a, b)
serverTaskProcessedSource Server s a b
server) (a
a, b
b)
forall (m :: * -> *) a. Monad m => a -> m a
return (b
b, s -> Maybe (Double, a, b) -> Stream a -> Stream b
loop s
s' (forall a. a -> Maybe a
Just (Double
t2, a
a, b
b)) Stream a
xs')
serverProcessPreempting :: Server s a b -> s -> a -> Process (s, b, Double)
serverProcessPreempting :: forall s a b. Server s a b -> s -> a -> Process (s, b, Double)
serverProcessPreempting Server s a b
server s
s a
a =
do ProcessId
pid <- Process ProcessId
processId
Double
t1 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
IORef Double
rs <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
0
IORef Double
r1 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. a -> IO (IORef a)
newIORef Double
t1
DisposableEvent
h1 <- forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
forall a. Signal a -> (a -> Event ()) -> Event DisposableEvent
handleSignal (ProcessId -> Signal ()
processPreemptionBeginning ProcessId
pid) forall a b. (a -> b) -> a -> b
$ \() ->
do Double
t1 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. IORef a -> a -> IO ()
writeIORef IORef Double
r1 Double
t1
forall a. SignalSource a -> a -> Event ()
triggerSignal (forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionBeginningSource Server s a b
server) a
a
DisposableEvent
h2 <- forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
forall a. Signal a -> (a -> Event ()) -> Event DisposableEvent
handleSignal (ProcessId -> Signal ()
processPreemptionEnding ProcessId
pid) forall a b. (a -> b) -> a -> b
$ \() ->
do Double
t1 <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. IORef a -> IO a
readIORef IORef Double
r1
Double
t2 <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Double
time
let dt :: Double
dt = Double
t2 forall a. Num a => a -> a -> a
- Double
t1
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$
do forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' IORef Double
rs (forall a. Num a => a -> a -> a
+ Double
dt)
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server) (forall a. Num a => a -> a -> a
+ Double
dt)
forall a. IORef a -> (a -> a) -> IO ()
modifyIORef' (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverPreemptionTimeRef Server s a b
server) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats Double
dt
forall a. SignalSource a -> a -> Event ()
triggerSignal (forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionEndingSource Server s a b
server) a
a
let m1 :: Process (s, b, Double)
m1 =
do (s
s', b
b) <- forall s a b. Server s a b -> s -> a -> Process (s, b)
serverProcess Server s a b
server s
s a
a
Double
dt <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. IORef a -> IO a
readIORef IORef Double
rs
forall (m :: * -> *) a. Monad m => a -> m a
return (s
s', b
b, Double
dt)
m2 :: Process ()
m2 =
forall (m :: * -> *) a. EventLift m => Event a -> m a
liftEvent forall a b. (a -> b) -> a -> b
$
do DisposableEvent -> Event ()
disposeEvent DisposableEvent
h1
DisposableEvent -> Event ()
disposeEvent DisposableEvent
h2
forall a b. Process a -> Process b -> Process a
finallyProcess Process (s, b, Double)
m1 Process ()
m2
serverState :: Server s a b -> Event s
serverState :: forall s a b. Server s a b -> Event s
serverState Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef s
serverStateRef Server s a b
server)
serverStateChanged :: Server s a b -> Signal s
serverStateChanged :: forall s a b. Server s a b -> Signal s
serverStateChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event s
serverState Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverStateChanged_ Server s a b
server)
serverStateChanged_ :: Server s a b -> Signal ()
serverStateChanged_ :: forall s a b. Server s a b -> Signal ()
serverStateChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server)
serverTotalInputWaitTime :: Server s a b -> Event Double
serverTotalInputWaitTime :: forall s a b. Server s a b -> Event Double
serverTotalInputWaitTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
serverTotalInputWaitTimeChanged :: Server s a b -> Signal Double
serverTotalInputWaitTimeChanged :: forall s a b. Server s a b -> Signal Double
serverTotalInputWaitTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverTotalInputWaitTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverTotalInputWaitTimeChanged_ Server s a b
server)
serverTotalInputWaitTimeChanged_ :: Server s a b -> Signal ()
serverTotalInputWaitTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverTotalInputWaitTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server)
serverTotalProcessingTime :: Server s a b -> Event Double
serverTotalProcessingTime :: forall s a b. Server s a b -> Event Double
serverTotalProcessingTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
serverTotalProcessingTimeChanged :: Server s a b -> Signal Double
serverTotalProcessingTimeChanged :: forall s a b. Server s a b -> Signal Double
serverTotalProcessingTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverTotalProcessingTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverTotalProcessingTimeChanged_ Server s a b
server)
serverTotalProcessingTimeChanged_ :: Server s a b -> Signal ()
serverTotalProcessingTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverTotalProcessingTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server)
serverTotalOutputWaitTime :: Server s a b -> Event Double
serverTotalOutputWaitTime :: forall s a b. Server s a b -> Event Double
serverTotalOutputWaitTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
serverTotalOutputWaitTimeChanged :: Server s a b -> Signal Double
serverTotalOutputWaitTimeChanged :: forall s a b. Server s a b -> Signal Double
serverTotalOutputWaitTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverTotalOutputWaitTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverTotalOutputWaitTimeChanged_ Server s a b
server)
serverTotalOutputWaitTimeChanged_ :: Server s a b -> Signal ()
serverTotalOutputWaitTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverTotalOutputWaitTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server)
serverTotalPreemptionTime :: Server s a b -> Event Double
serverTotalPreemptionTime :: forall s a b. Server s a b -> Event Double
serverTotalPreemptionTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
serverTotalPreemptionTimeChanged :: Server s a b -> Signal Double
serverTotalPreemptionTimeChanged :: forall s a b. Server s a b -> Signal Double
serverTotalPreemptionTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverTotalPreemptionTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverTotalPreemptionTimeChanged_ Server s a b
server)
serverTotalPreemptionTimeChanged_ :: Server s a b -> Signal ()
serverTotalPreemptionTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverTotalPreemptionTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverInputWaitTime :: Server s a b -> Event (SamplingStats Double)
serverInputWaitTime :: forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverInputWaitTimeRef Server s a b
server)
serverInputWaitTimeChanged :: Server s a b -> Signal (SamplingStats Double)
serverInputWaitTimeChanged :: forall s a b. Server s a b -> Signal (SamplingStats Double)
serverInputWaitTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_ Server s a b
server)
serverInputWaitTimeChanged_ :: Server s a b -> Signal ()
serverInputWaitTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server)
serverProcessingTime :: Server s a b -> Event (SamplingStats Double)
serverProcessingTime :: forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverProcessingTimeRef Server s a b
server)
serverProcessingTimeChanged :: Server s a b -> Signal (SamplingStats Double)
serverProcessingTimeChanged :: forall s a b. Server s a b -> Signal (SamplingStats Double)
serverProcessingTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_ Server s a b
server)
serverProcessingTimeChanged_ :: Server s a b -> Signal ()
serverProcessingTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server)
serverOutputWaitTime :: Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime :: forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverOutputWaitTimeRef Server s a b
server)
serverOutputWaitTimeChanged :: Server s a b -> Signal (SamplingStats Double)
serverOutputWaitTimeChanged :: forall s a b. Server s a b -> Signal (SamplingStats Double)
serverOutputWaitTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_ Server s a b
server)
serverOutputWaitTimeChanged_ :: Server s a b -> Signal ()
serverOutputWaitTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server)
serverPreemptionTime :: Server s a b -> Event (SamplingStats Double)
serverPreemptionTime :: forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p -> forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverPreemptionTimeRef Server s a b
server)
serverPreemptionTimeChanged :: Server s a b -> Signal (SamplingStats Double)
serverPreemptionTimeChanged :: forall s a b. Server s a b -> Signal (SamplingStats Double)
serverPreemptionTimeChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_ Server s a b
server)
serverPreemptionTimeChanged_ :: Server s a b -> Signal ()
serverPreemptionTimeChanged_ :: forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverInputWaitFactor :: Server s a b -> Event Double
serverInputWaitFactor :: forall s a b. Server s a b -> Event Double
serverInputWaitFactor Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do Double
x1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
Double
x2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
Double
x3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
Double
x4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x1 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3 forall a. Num a => a -> a -> a
+ Double
x4))
serverInputWaitFactorChanged :: Server s a b -> Signal Double
serverInputWaitFactorChanged :: forall s a b. Server s a b -> Signal Double
serverInputWaitFactorChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverInputWaitFactor Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_ Server s a b
server)
serverInputWaitFactorChanged_ :: Server s a b -> Signal ()
serverInputWaitFactorChanged_ :: forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverProcessingFactor :: Server s a b -> Event Double
serverProcessingFactor :: forall s a b. Server s a b -> Event Double
serverProcessingFactor Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do Double
x1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
Double
x2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
Double
x3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
Double
x4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x2 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3 forall a. Num a => a -> a -> a
+ Double
x4))
serverProcessingFactorChanged :: Server s a b -> Signal Double
serverProcessingFactorChanged :: forall s a b. Server s a b -> Signal Double
serverProcessingFactorChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverProcessingFactor Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_ Server s a b
server)
serverProcessingFactorChanged_ :: Server s a b -> Signal ()
serverProcessingFactorChanged_ :: forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverOutputWaitFactor :: Server s a b -> Event Double
serverOutputWaitFactor :: forall s a b. Server s a b -> Event Double
serverOutputWaitFactor Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do Double
x1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
Double
x2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
Double
x3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
Double
x4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x3 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3 forall a. Num a => a -> a -> a
+ Double
x4))
serverOutputWaitFactorChanged :: Server s a b -> Signal Double
serverOutputWaitFactorChanged :: forall s a b. Server s a b -> Signal Double
serverOutputWaitFactorChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverOutputWaitFactor Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_ Server s a b
server)
serverOutputWaitFactorChanged_ :: Server s a b -> Signal ()
serverOutputWaitFactorChanged_ :: forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverPreemptionFactor :: Server s a b -> Event Double
serverPreemptionFactor :: forall s a b. Server s a b -> Event Double
serverPreemptionFactor Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do Double
x1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
Double
x2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
Double
x3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
Double
x4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x4 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3 forall a. Num a => a -> a -> a
+ Double
x4))
serverPreemptionFactorChanged :: Server s a b -> Signal Double
serverPreemptionFactorChanged :: forall s a b. Server s a b -> Signal Double
serverPreemptionFactorChanged Server s a b
server =
forall a b. (a -> Event b) -> Signal a -> Signal b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Event Double
serverPreemptionFactor Server s a b
server) (forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ Server s a b
server)
serverPreemptionFactorChanged_ :: Server s a b -> Signal ()
serverPreemptionFactorChanged_ :: forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverInputReceived :: Server s a b -> Signal a
serverInputReceived :: forall s a b. Server s a b -> Signal a
serverInputReceived = forall a. SignalSource a -> Signal a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b. Server s a b -> SignalSource a
serverInputReceivedSource
serverTaskPreemptionBeginning :: Server s a b -> Signal a
serverTaskPreemptionBeginning :: forall s a b. Server s a b -> Signal a
serverTaskPreemptionBeginning = forall a. SignalSource a -> Signal a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionBeginningSource
serverTaskPreemptionEnding :: Server s a b -> Signal a
serverTaskPreemptionEnding :: forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding = forall a. SignalSource a -> Signal a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b. Server s a b -> SignalSource a
serverTaskPreemptionEndingSource
serverTaskProcessed :: Server s a b -> Signal (a, b)
serverTaskProcessed :: forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed = forall a. SignalSource a -> Signal a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b. Server s a b -> SignalSource (a, b)
serverTaskProcessedSource
serverOutputProvided :: Server s a b -> Signal (a, b)
serverOutputProvided :: forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided = forall a. SignalSource a -> Signal a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a b. Server s a b -> SignalSource (a, b)
serverOutputProvidedSource
serverChanged_ :: Server s a b -> Signal ()
serverChanged_ :: forall s a b. Server s a b -> Signal ()
serverChanged_ Server s a b
server =
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverInputReceived Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverTaskProcessed Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal (a, b)
serverOutputProvided Server s a b
server) forall a. Semigroup a => a -> a -> a
<>
forall a b. (a -> b) -> Signal a -> Signal b
mapSignal (forall a b. a -> b -> a
const ()) (forall s a b. Server s a b -> Signal a
serverTaskPreemptionEnding Server s a b
server)
serverSummary :: Server s a b -> Int -> Event ShowS
serverSummary :: forall s a b. Server s a b -> Int -> Event ShowS
serverSummary Server s a b
server Int
indent =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do Double
tx1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server)
Double
tx2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server)
Double
tx3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server)
Double
tx4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server)
let xf1 :: Double
xf1 = Double
tx1 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3 forall a. Num a => a -> a -> a
+ Double
tx4)
xf2 :: Double
xf2 = Double
tx2 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3 forall a. Num a => a -> a -> a
+ Double
tx4)
xf3 :: Double
xf3 = Double
tx3 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3 forall a. Num a => a -> a -> a
+ Double
tx4)
xf4 :: Double
xf4 = Double
tx4 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx3 forall a. Num a => a -> a -> a
+ Double
tx3 forall a. Num a => a -> a -> a
+ Double
tx4)
SamplingStats Double
xs1 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverInputWaitTimeRef Server s a b
server)
SamplingStats Double
xs2 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverProcessingTimeRef Server s a b
server)
SamplingStats Double
xs3 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverOutputWaitTimeRef Server s a b
server)
SamplingStats Double
xs4 <- forall a. IORef a -> IO a
readIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverPreemptionTimeRef Server s a b
server)
let tab :: [Char]
tab = forall a. Int -> a -> [a]
replicate Int
indent Char
' '
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total input wait time (locked while awaiting the input) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx1 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total processing time = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx2 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total output wait time (locked while delivering the output) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx3 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total preemption time = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx4 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"input wait factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf1 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"processing factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf2 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"output wait factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf3 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"output preemption factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf4 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"input wait time (locked while awaiting the input):\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs1 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent) forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"processing time:\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs2 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent) forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"output wait time (locked while delivering the output):\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs3 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent) forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"preemption time (waiting for the proceeding after preemption):\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs4 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent)
resetServer :: Server s a b -> Event ()
resetServer :: forall s a b. Server s a b -> Event ()
resetServer Server s a b
server =
forall a. (Point -> IO a) -> Event a
Event forall a b. (a -> b) -> a -> b
$ \Point
p ->
do forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef Double
serverTotalInputWaitTimeRef Server s a b
server) Double
0
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef Double
serverTotalProcessingTimeRef Server s a b
server) Double
0
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef Double
serverTotalOutputWaitTimeRef Server s a b
server) Double
0
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef Double
serverTotalPreemptionTimeRef Server s a b
server) Double
0
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverInputWaitTimeRef Server s a b
server) forall a. Monoid a => a
mempty
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverProcessingTimeRef Server s a b
server) forall a. Monoid a => a
mempty
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverOutputWaitTimeRef Server s a b
server) forall a. Monoid a => a
mempty
forall a. IORef a -> a -> IO ()
writeIORef (forall s a b. Server s a b -> IORef (SamplingStats Double)
serverPreemptionTimeRef Server s a b
server) forall a. Monoid a => a
mempty