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