module Simulation.Aivika.Trans.Activity
(
Activity,
newActivity,
newStateActivity,
newPreemptibleActivity,
newPreemptibleStateActivity,
activityNet,
activityInitState,
activityState,
activityTotalUtilisationTime,
activityTotalIdleTime,
activityTotalPreemptionTime,
activityUtilisationTime,
activityIdleTime,
activityPreemptionTime,
activityUtilisationFactor,
activityIdleFactor,
activityPreemptionFactor,
resetActivity,
activitySummary,
activityStateChanged,
activityStateChanged_,
activityTotalUtilisationTimeChanged,
activityTotalUtilisationTimeChanged_,
activityTotalIdleTimeChanged,
activityTotalIdleTimeChanged_,
activityTotalPreemptionTimeChanged,
activityTotalPreemptionTimeChanged_,
activityUtilisationTimeChanged,
activityUtilisationTimeChanged_,
activityIdleTimeChanged,
activityIdleTimeChanged_,
activityPreemptionTimeChanged,
activityPreemptionTimeChanged_,
activityUtilisationFactorChanged,
activityUtilisationFactorChanged_,
activityIdleFactorChanged,
activityIdleFactorChanged_,
activityPreemptionFactorChanged,
activityPreemptionFactorChanged_,
activityUtilising,
activityUtilised,
activityPreemptionBeginning,
activityPreemptionEnding,
activityChanged_) where
import Data.Monoid
import Control.Monad
import Control.Monad.Trans
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.Net
import Simulation.Aivika.Trans.Server
import Simulation.Aivika.Trans.Statistics
data Activity m s a b =
Activity { forall (m :: * -> *) s a b. Activity m s a b -> s
activityInitState :: s,
forall (m :: * -> *) s a b. Activity m s a b -> Ref m s
activityStateRef :: Ref m s,
forall (m :: * -> *) s a b.
Activity m s a b -> s -> a -> Process m (s, b)
activityProcess :: s -> a -> Process m (s, b),
forall (m :: * -> *) s a b. Activity m s a b -> Bool
activityProcessPreemptible :: Bool,
forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef :: Ref m Double,
forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef :: Ref m Double,
forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef :: Ref m Double,
forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityUtilisationTimeRef :: Ref m (SamplingStats Double),
forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityIdleTimeRef :: Ref m (SamplingStats Double),
forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityPreemptionTimeRef :: Ref m (SamplingStats Double),
forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityUtilisingSource :: SignalSource m a,
forall (m :: * -> *) s a b.
Activity m s a b -> SignalSource m (a, b)
activityUtilisedSource :: SignalSource m (a, b),
forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionBeginningSource :: SignalSource m a,
forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionEndingSource :: SignalSource m a
}
newActivity :: MonadDES m
=> (a -> Process m b)
-> Simulation m (Activity m () a b)
{-# INLINABLE newActivity #-}
newActivity :: forall (m :: * -> *) a b.
MonadDES m =>
(a -> Process m b) -> Simulation m (Activity m () a b)
newActivity = forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Simulation m (Activity m () a b)
newPreemptibleActivity Bool
False
newStateActivity :: MonadDES m
=> (s -> a -> Process m (s, b))
-> s
-> Simulation m (Activity m s a b)
{-# INLINABLE newStateActivity #-}
newStateActivity :: forall (m :: * -> *) s a b.
MonadDES m =>
(s -> a -> Process m (s, b))
-> s -> Simulation m (Activity m s a b)
newStateActivity = forall (m :: * -> *) s a b.
MonadDES m =>
Bool
-> (s -> a -> Process m (s, b))
-> s
-> Simulation m (Activity m s a b)
newPreemptibleStateActivity Bool
False
newPreemptibleActivity :: MonadDES m
=> Bool
-> (a -> Process m b)
-> Simulation m (Activity m () a b)
{-# INLINABLE newPreemptibleActivity #-}
newPreemptibleActivity :: forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Simulation m (Activity m () a b)
newPreemptibleActivity Bool
preemptible a -> Process m b
provide =
forall a b c. (a -> b -> c) -> b -> a -> c
flip (forall (m :: * -> *) s a b.
MonadDES m =>
Bool
-> (s -> a -> Process m (s, b))
-> s
-> Simulation m (Activity m s a b)
newPreemptibleStateActivity Bool
preemptible) () forall a b. (a -> b) -> a -> b
$ \()
s a
a ->
do b
b <- a -> Process m b
provide a
a
forall (m :: * -> *) a. Monad m => a -> m a
return (()
s, b
b)
newPreemptibleStateActivity :: MonadDES m
=> Bool
-> (s -> a -> Process m (s, b))
-> s
-> Simulation m (Activity m s a b)
{-# INLINABLE newPreemptibleStateActivity #-}
newPreemptibleStateActivity :: forall (m :: * -> *) s a b.
MonadDES m =>
Bool
-> (s -> a -> Process m (s, b))
-> s
-> Simulation m (Activity m s a b)
newPreemptibleStateActivity Bool
preemptible s -> a -> Process m (s, b)
provide s
state =
do Ref m s
r0 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef s
state
Ref m Double
r1 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef Double
0
Ref m Double
r2 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef Double
0
Ref m Double
r3 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef Double
0
Ref m (SamplingStats Double)
r4 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef forall a. SamplingData a => SamplingStats a
emptySamplingStats
Ref m (SamplingStats Double)
r5 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef forall a. SamplingData a => SamplingStats a
emptySamplingStats
Ref m (SamplingStats Double)
r6 <- forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef forall a. SamplingData a => SamplingStats a
emptySamplingStats
SignalSource m a
s1 <- forall (m :: * -> *) a.
MonadDES m =>
Simulation m (SignalSource m a)
newSignalSource
SignalSource m (a, b)
s2 <- forall (m :: * -> *) a.
MonadDES m =>
Simulation m (SignalSource m a)
newSignalSource
SignalSource m a
s3 <- forall (m :: * -> *) a.
MonadDES m =>
Simulation m (SignalSource m a)
newSignalSource
SignalSource m a
s4 <- forall (m :: * -> *) a.
MonadDES m =>
Simulation m (SignalSource m a)
newSignalSource
forall (m :: * -> *) a. Monad m => a -> m a
return Activity { activityInitState :: s
activityInitState = s
state,
activityStateRef :: Ref m s
activityStateRef = Ref m s
r0,
activityProcess :: s -> a -> Process m (s, b)
activityProcess = s -> a -> Process m (s, b)
provide,
activityProcessPreemptible :: Bool
activityProcessPreemptible = Bool
preemptible,
activityTotalUtilisationTimeRef :: Ref m Double
activityTotalUtilisationTimeRef = Ref m Double
r1,
activityTotalIdleTimeRef :: Ref m Double
activityTotalIdleTimeRef = Ref m Double
r2,
activityTotalPreemptionTimeRef :: Ref m Double
activityTotalPreemptionTimeRef = Ref m Double
r3,
activityUtilisationTimeRef :: Ref m (SamplingStats Double)
activityUtilisationTimeRef = Ref m (SamplingStats Double)
r4,
activityIdleTimeRef :: Ref m (SamplingStats Double)
activityIdleTimeRef = Ref m (SamplingStats Double)
r5,
activityPreemptionTimeRef :: Ref m (SamplingStats Double)
activityPreemptionTimeRef = Ref m (SamplingStats Double)
r6,
activityUtilisingSource :: SignalSource m a
activityUtilisingSource = SignalSource m a
s1,
activityUtilisedSource :: SignalSource m (a, b)
activityUtilisedSource = SignalSource m (a, b)
s2,
activityPreemptionBeginningSource :: SignalSource m a
activityPreemptionBeginningSource = SignalSource m a
s3,
activityPreemptionEndingSource :: SignalSource m a
activityPreemptionEndingSource = SignalSource m a
s4 }
activityNet :: MonadDES m => Activity m s a b -> Net m a b
{-# INLINABLE activityNet #-}
activityNet :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Net m a b
activityNet Activity m s a b
act = forall (m :: * -> *) a b.
(a -> Process m (b, Net m a b)) -> Net m a b
Net forall a b. (a -> b) -> a -> b
$ s -> Maybe Double -> a -> Process m (b, Net m a b)
loop (forall (m :: * -> *) s a b. Activity m s a b -> s
activityInitState Activity m s a b
act) forall a. Maybe a
Nothing
where
loop :: s -> Maybe Double -> a -> Process m (b, Net m a b)
loop s
s Maybe Double
r a
a =
do Double
t0 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics forall (m :: * -> *). Monad m => Dynamics m Double
time
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$
do case Maybe Double
r of
Maybe Double
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
Just Double
t' ->
do forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act) (forall a. Num a => a -> a -> a
+ (Double
t0 forall a. Num a => a -> a -> a
- Double
t'))
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityIdleTimeRef Activity m s a b
act) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats (Double
t0 forall a. Num a => a -> a -> a
- Double
t')
forall (m :: * -> *) a. SignalSource m a -> a -> Event m ()
triggerSignal (forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityUtilisingSource Activity m s a b
act) a
a
(s
s', b
b, Double
dt) <- if forall (m :: * -> *) s a b. Activity m s a b -> Bool
activityProcessPreemptible Activity m s a b
act
then forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> s -> a -> Process m (s, b, Double)
activityProcessPreempting Activity m s a b
act s
s a
a
else do (s
s', b
b) <- forall (m :: * -> *) s a b.
Activity m s a b -> s -> a -> Process m (s, b)
activityProcess Activity m s a b
act s
s a
a
forall (m :: * -> *) a. Monad m => a -> m a
return (s
s', b
b, Double
0)
Double
t1 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics forall (m :: * -> *). Monad m => Dynamics m Double
time
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$
do forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m s
activityStateRef Activity m s a b
act) forall a b. (a -> b) -> a -> b
$! s
s'
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act) (forall a. Num a => a -> a -> a
+ (Double
t1 forall a. Num a => a -> a -> a
- Double
t0 forall a. Num a => a -> a -> a
- Double
dt))
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityUtilisationTimeRef Activity m s a b
act) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats (Double
t1 forall a. Num a => a -> a -> a
- Double
t0 forall a. Num a => a -> a -> a
- Double
dt)
forall (m :: * -> *) a. SignalSource m a -> a -> Event m ()
triggerSignal (forall (m :: * -> *) s a b.
Activity m s a b -> SignalSource m (a, b)
activityUtilisedSource Activity m s a b
act) (a
a, b
b)
forall (m :: * -> *) a. Monad m => a -> m a
return (b
b, forall (m :: * -> *) a b.
(a -> Process m (b, Net m a b)) -> Net m a b
Net forall a b. (a -> b) -> a -> b
$ s -> Maybe Double -> a -> Process m (b, Net m a b)
loop s
s' (forall a. a -> Maybe a
Just Double
t1))
activityProcessPreempting :: MonadDES m => Activity m s a b -> s -> a -> Process m (s, b, Double)
{-# INLINABLE activityProcessPreempting #-}
activityProcessPreempting :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> s -> a -> Process m (s, b, Double)
activityProcessPreempting Activity m s a b
act s
s a
a =
do ProcessId m
pid <- forall (m :: * -> *). MonadDES m => Process m (ProcessId m)
processId
Double
t0 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics forall (m :: * -> *). Monad m => Dynamics m Double
time
Ref m Double
rs <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
SimulationLift t m =>
Simulation m a -> t m a
liftSimulation forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef Double
0
Ref m Double
r0 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
SimulationLift t m =>
Simulation m a -> t m a
liftSimulation forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => a -> Simulation m (Ref m a)
newRef Double
t0
DisposableEvent m
h1 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a.
Signal m a -> (a -> Event m ()) -> Event m (DisposableEvent m)
handleSignal (forall (m :: * -> *). MonadDES m => ProcessId m -> Signal m ()
processPreemptionBeginning ProcessId m
pid) forall a b. (a -> b) -> a -> b
$ \() ->
do Double
t0 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics forall (m :: * -> *). Monad m => Dynamics m Double
time
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef Ref m Double
r0 Double
t0
forall (m :: * -> *) a. SignalSource m a -> a -> Event m ()
triggerSignal (forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionBeginningSource Activity m s a b
act) a
a
DisposableEvent m
h2 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a.
Signal m a -> (a -> Event m ()) -> Event m (DisposableEvent m)
handleSignal (forall (m :: * -> *). MonadDES m => ProcessId m -> Signal m ()
processPreemptionEnding ProcessId m
pid) forall a b. (a -> b) -> a -> b
$ \() ->
do Double
t0 <- forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef Ref m Double
r0
Double
t1 <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics forall (m :: * -> *). Monad m => Dynamics m Double
time
let dt :: Double
dt = Double
t1 forall a. Num a => a -> a -> a
- Double
t0
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef Ref m Double
rs (forall a. Num a => a -> a -> a
+ Double
dt)
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act) (forall a. Num a => a -> a -> a
+ Double
dt)
forall (m :: * -> *) a.
MonadRef m =>
Ref m a -> (a -> a) -> Event m ()
modifyRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityPreemptionTimeRef Activity m s a b
act) forall a b. (a -> b) -> a -> b
$
forall a. SamplingData a => a -> SamplingStats a -> SamplingStats a
addSamplingStats Double
dt
forall (m :: * -> *) a. SignalSource m a -> a -> Event m ()
triggerSignal (forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionEndingSource Activity m s a b
act) a
a
let m1 :: Process m (s, b, Double)
m1 =
do (s
s', b
b) <- forall (m :: * -> *) s a b.
Activity m s a b -> s -> a -> Process m (s, b)
activityProcess Activity m s a b
act s
s a
a
Double
dt <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef Ref m Double
rs
forall (m :: * -> *) a. Monad m => a -> m a
return (s
s', b
b, Double
dt)
m2 :: Process m ()
m2 =
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent forall a b. (a -> b) -> a -> b
$
do forall (m :: * -> *). DisposableEvent m -> Event m ()
disposeEvent DisposableEvent m
h1
forall (m :: * -> *). DisposableEvent m -> Event m ()
disposeEvent DisposableEvent m
h2
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
activityState :: MonadDES m => Activity m s a b -> Event m s
{-# INLINABLE activityState #-}
activityState :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m s
activityState Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m s
activityStateRef Activity m s a b
act)
activityStateChanged :: MonadDES m => Activity m s a b -> Signal m s
{-# INLINABLE activityStateChanged #-}
activityStateChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m s
activityStateChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m s
activityState Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityStateChanged_ Activity m s a b
act)
activityStateChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityStateChanged_ #-}
activityStateChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityStateChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act)
activityTotalUtilisationTime :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityTotalUtilisationTime #-}
activityTotalUtilisationTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalUtilisationTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act)
activityTotalUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityTotalUtilisationTimeChanged #-}
activityTotalUtilisationTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityTotalUtilisationTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalUtilisationTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalUtilisationTimeChanged_ Activity m s a b
act)
activityTotalUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityTotalUtilisationTimeChanged_ #-}
activityTotalUtilisationTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalUtilisationTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act)
activityTotalIdleTime :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityTotalIdleTime #-}
activityTotalIdleTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalIdleTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act)
activityTotalIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityTotalIdleTimeChanged #-}
activityTotalIdleTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityTotalIdleTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalIdleTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalIdleTimeChanged_ Activity m s a b
act)
activityTotalIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityTotalIdleTimeChanged_ #-}
activityTotalIdleTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalIdleTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act)
activityTotalPreemptionTime :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityTotalPreemptionTime #-}
activityTotalPreemptionTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalPreemptionTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act)
activityTotalPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityTotalPreemptionTimeChanged #-}
activityTotalPreemptionTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityTotalPreemptionTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityTotalPreemptionTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalPreemptionTimeChanged_ Activity m s a b
act)
activityTotalPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityTotalPreemptionTimeChanged_ #-}
activityTotalPreemptionTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityTotalPreemptionTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activityUtilisationTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
{-# INLINABLE activityUtilisationTime #-}
activityUtilisationTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityUtilisationTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityUtilisationTimeRef Activity m s a b
act)
activityUtilisationTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
{-# INLINABLE activityUtilisationTimeChanged #-}
activityUtilisationTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m (SamplingStats Double)
activityUtilisationTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityUtilisationTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityUtilisationTimeChanged_ Activity m s a b
act)
activityUtilisationTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityUtilisationTimeChanged_ #-}
activityUtilisationTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityUtilisationTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act)
activityIdleTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
{-# INLINABLE activityIdleTime #-}
activityIdleTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityIdleTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityIdleTimeRef Activity m s a b
act)
activityIdleTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
{-# INLINABLE activityIdleTimeChanged #-}
activityIdleTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m (SamplingStats Double)
activityIdleTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityIdleTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityIdleTimeChanged_ Activity m s a b
act)
activityIdleTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityIdleTimeChanged_ #-}
activityIdleTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityIdleTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act)
activityPreemptionTime :: MonadDES m => Activity m s a b -> Event m (SamplingStats Double)
{-# INLINABLE activityPreemptionTime #-}
activityPreemptionTime :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityPreemptionTime Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p -> forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityPreemptionTimeRef Activity m s a b
act)
activityPreemptionTimeChanged :: MonadDES m => Activity m s a b -> Signal m (SamplingStats Double)
{-# INLINABLE activityPreemptionTimeChanged #-}
activityPreemptionTimeChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m (SamplingStats Double)
activityPreemptionTimeChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m (SamplingStats Double)
activityPreemptionTime Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityPreemptionTimeChanged_ Activity m s a b
act)
activityPreemptionTimeChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityPreemptionTimeChanged_ #-}
activityPreemptionTimeChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityPreemptionTimeChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activityUtilisationFactor :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityUtilisationFactor #-}
activityUtilisationFactor :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityUtilisationFactor Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do Double
x1 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act)
Double
x2 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act)
Double
x3 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x1 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3))
activityUtilisationFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityUtilisationFactorChanged #-}
activityUtilisationFactorChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityUtilisationFactorChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityUtilisationFactor Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityUtilisationFactorChanged_ Activity m s a b
act)
activityUtilisationFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityUtilisationFactorChanged_ #-}
activityUtilisationFactorChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityUtilisationFactorChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activityIdleFactor :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityIdleFactor #-}
activityIdleFactor :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityIdleFactor Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do Double
x1 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act)
Double
x2 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act)
Double
x3 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x2 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3))
activityIdleFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityIdleFactorChanged #-}
activityIdleFactorChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityIdleFactorChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityIdleFactor Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityIdleFactorChanged_ Activity m s a b
act)
activityIdleFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityIdleFactorChanged_ #-}
activityIdleFactorChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityIdleFactorChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activityPreemptionFactor :: MonadDES m => Activity m s a b -> Event m Double
{-# INLINABLE activityPreemptionFactor #-}
activityPreemptionFactor :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityPreemptionFactor Activity m s a b
act =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do Double
x1 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act)
Double
x2 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act)
Double
x3 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x3 forall a. Fractional a => a -> a -> a
/ (Double
x1 forall a. Num a => a -> a -> a
+ Double
x2 forall a. Num a => a -> a -> a
+ Double
x3))
activityPreemptionFactorChanged :: MonadDES m => Activity m s a b -> Signal m Double
{-# INLINABLE activityPreemptionFactorChanged #-}
activityPreemptionFactorChanged :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m Double
activityPreemptionFactorChanged Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> Event m b) -> Signal m a -> Signal m b
mapSignalM (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m Double
activityPreemptionFactor Activity m s a b
act) (forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityPreemptionFactorChanged_ Activity m s a b
act)
activityPreemptionFactorChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityPreemptionFactorChanged_ #-}
activityPreemptionFactorChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityPreemptionFactorChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activityUtilising :: Activity m s a b -> Signal m a
{-# INLINABLE activityUtilising #-}
activityUtilising :: forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising = forall (m :: * -> *) a. SignalSource m a -> Signal m a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityUtilisingSource
activityUtilised :: Activity m s a b -> Signal m (a, b)
{-# INLINABLE activityUtilised #-}
activityUtilised :: forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised = forall (m :: * -> *) a. SignalSource m a -> Signal m a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a b.
Activity m s a b -> SignalSource m (a, b)
activityUtilisedSource
activityPreemptionBeginning :: Activity m s a b -> Signal m a
{-# INLINABLE activityPreemptionBeginning #-}
activityPreemptionBeginning :: forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionBeginning = forall (m :: * -> *) a. SignalSource m a -> Signal m a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionBeginningSource
activityPreemptionEnding :: Activity m s a b -> Signal m a
{-# INLINABLE activityPreemptionEnding #-}
activityPreemptionEnding :: forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding = forall (m :: * -> *) a. SignalSource m a -> Signal m a
publishSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a b. Activity m s a b -> SignalSource m a
activityPreemptionEndingSource
activityChanged_ :: MonadDES m => Activity m s a b -> Signal m ()
{-# INLINABLE activityChanged_ #-}
activityChanged_ :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Signal m ()
activityChanged_ Activity m s a b
act =
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityUtilising Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m (a, b)
activityUtilised Activity m s a b
act) forall a. Semigroup a => a -> a -> a
<>
forall (m :: * -> *) a b.
MonadDES m =>
(a -> b) -> Signal m a -> Signal m b
mapSignal (forall a b. a -> b -> a
const ()) (forall (m :: * -> *) s a b. Activity m s a b -> Signal m a
activityPreemptionEnding Activity m s a b
act)
activitySummary :: MonadDES m => Activity m s a b -> Int -> Event m ShowS
{-# INLINABLE activitySummary #-}
activitySummary :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Int -> Event m ShowS
activitySummary Activity m s a b
act Int
indent =
forall (m :: * -> *) a. (Point m -> m a) -> Event m a
Event forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do Double
tx1 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act)
Double
tx2 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act)
Double
tx3 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act)
let xf1 :: Double
xf1 = Double
tx1 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3)
xf2 :: Double
xf2 = Double
tx2 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3)
xf3 :: Double
xf3 = Double
tx3 forall a. Fractional a => a -> a -> a
/ (Double
tx1 forall a. Num a => a -> a -> a
+ Double
tx2 forall a. Num a => a -> a -> a
+ Double
tx3)
SamplingStats Double
xs1 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityUtilisationTimeRef Activity m s a b
act)
SamplingStats Double
xs2 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityIdleTimeRef Activity m s a b
act)
SamplingStats Double
xs3 <- forall (m :: * -> *) a. Point m -> Event m a -> m a
invokeEvent Point m
p forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadRef m => Ref m a -> Event m a
readRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityPreemptionTimeRef Activity m s a b
act)
let tab :: [Char]
tab = forall a. Int -> a -> [a]
replicate Int
indent Char
' '
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total utilisation time = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx1 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total idle time = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx2 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"total preemption time = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
tx3 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"utilisation factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf1 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"idle factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf2 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"preemption factor (from 0 to 1) = " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> ShowS
shows Double
xf3 forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"utilisation time (locked while awaiting the input):\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs1 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent) forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"idle time:\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs2 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent) forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
tab forall b c a. (b -> c) -> (a -> b) -> a -> c
.
[Char] -> ShowS
showString [Char]
"preemption time:\n\n" forall b c a. (b -> c) -> (a -> b) -> a -> c
.
forall a. Show a => SamplingStats a -> Int -> ShowS
samplingStatsSummary SamplingStats Double
xs3 (Int
2 forall a. Num a => a -> a -> a
+ Int
indent)
resetActivity :: MonadDES m => Activity m s a b -> Event m ()
{-# INLINABLE resetActivity #-}
resetActivity :: forall (m :: * -> *) s a b.
MonadDES m =>
Activity m s a b -> Event m ()
resetActivity Activity m s a b
act =
do forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalUtilisationTimeRef Activity m s a b
act) Double
0
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalIdleTimeRef Activity m s a b
act) Double
0
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b. Activity m s a b -> Ref m Double
activityTotalPreemptionTimeRef Activity m s a b
act) Double
0
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityUtilisationTimeRef Activity m s a b
act) forall a. Monoid a => a
mempty
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityIdleTimeRef Activity m s a b
act) forall a. Monoid a => a
mempty
forall (m :: * -> *) a. MonadRef m => Ref m a -> a -> Event m ()
writeRef (forall (m :: * -> *) s a b.
Activity m s a b -> Ref m (SamplingStats Double)
activityPreemptionTimeRef Activity m s a b
act) forall a. Monoid a => a
mempty