Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Activity s a b
- newActivity :: (a -> Process b) -> Simulation (Activity () a b)
- newStateActivity :: (s -> a -> Process (s, b)) -> s -> Simulation (Activity s a b)
- newPreemptibleActivity :: Bool -> (a -> Process b) -> Simulation (Activity () a b)
- newPreemptibleStateActivity :: Bool -> (s -> a -> Process (s, b)) -> s -> Simulation (Activity s a b)
- activityNet :: Activity s a b -> Net a b
- activityInitState :: Activity s a b -> s
- activityState :: Activity s a b -> Event s
- activityTotalUtilisationTime :: Activity s a b -> Event Double
- activityTotalIdleTime :: Activity s a b -> Event Double
- activityTotalPreemptionTime :: Activity s a b -> Event Double
- activityUtilisationTime :: Activity s a b -> Event (SamplingStats Double)
- activityIdleTime :: Activity s a b -> Event (SamplingStats Double)
- activityPreemptionTime :: Activity s a b -> Event (SamplingStats Double)
- activityUtilisationFactor :: Activity s a b -> Event Double
- activityIdleFactor :: Activity s a b -> Event Double
- activityPreemptionFactor :: Activity s a b -> Event Double
- resetActivity :: Activity s a b -> Event ()
- activitySummary :: Activity s a b -> Int -> Event ShowS
- activityStateChanged :: Activity s a b -> Signal s
- activityStateChanged_ :: Activity s a b -> Signal ()
- activityTotalUtilisationTimeChanged :: Activity s a b -> Signal Double
- activityTotalUtilisationTimeChanged_ :: Activity s a b -> Signal ()
- activityTotalIdleTimeChanged :: Activity s a b -> Signal Double
- activityTotalIdleTimeChanged_ :: Activity s a b -> Signal ()
- activityTotalPreemptionTimeChanged :: Activity s a b -> Signal Double
- activityTotalPreemptionTimeChanged_ :: Activity s a b -> Signal ()
- activityUtilisationTimeChanged :: Activity s a b -> Signal (SamplingStats Double)
- activityUtilisationTimeChanged_ :: Activity s a b -> Signal ()
- activityIdleTimeChanged :: Activity s a b -> Signal (SamplingStats Double)
- activityIdleTimeChanged_ :: Activity s a b -> Signal ()
- activityPreemptionTimeChanged :: Activity s a b -> Signal (SamplingStats Double)
- activityPreemptionTimeChanged_ :: Activity s a b -> Signal ()
- activityUtilisationFactorChanged :: Activity s a b -> Signal Double
- activityUtilisationFactorChanged_ :: Activity s a b -> Signal ()
- activityIdleFactorChanged :: Activity s a b -> Signal Double
- activityIdleFactorChanged_ :: Activity s a b -> Signal ()
- activityPreemptionFactorChanged :: Activity s a b -> Signal Double
- activityPreemptionFactorChanged_ :: Activity s a b -> Signal ()
- activityUtilising :: Activity s a b -> Signal a
- activityUtilised :: Activity s a b -> Signal (a, b)
- activityPreemptionBeginning :: Activity s a b -> Signal a
- activityPreemptionEnding :: Activity s a b -> Signal a
- activityChanged_ :: Activity s a b -> Signal ()
Activity
Like Server
it models an activity that takes a
and provides b
having state s
.
But unlike the former the activity is destined for simulation within Net
computation.
Instances
(Show s, ResultItemable (ResultValue s)) => ResultProvider (Activity s a b) Source # | |
Defined in Simulation.Aivika.Results resultSource :: ResultName -> ResultDescription -> Activity s a b -> ResultSource Source # resultSource3 :: ResultName -> ResultDescription -> ResultDescription -> Activity s a b -> ResultSource Source # resultSource' :: ResultName -> [ResultName] -> ResultId -> [ResultId] -> Activity s a b -> ResultSource Source # |
:: (a -> Process b) | provide an output by the specified input |
-> Simulation (Activity () a b) |
Create a new activity that can provide output b
by input a
.
By default, it is assumed that the activity utilisation cannot be preempted, because the handling of possible task preemption is rather costly operation.
:: (s -> a -> Process (s, b)) | provide a new state and output by the specified old state and input |
-> s | the initial state |
-> Simulation (Activity s a b) |
Create a new activity that can provide output b
by input a
starting from state s
.
By default, it is assumed that the activity utilisation cannot be preempted, because the handling of possible task preemption is rather costly operation.
newPreemptibleActivity Source #
:: Bool | whether the activity can be preempted |
-> (a -> Process b) | provide an output by the specified input |
-> Simulation (Activity () a b) |
Create a new preemptible activity that can provide output b
by input a
.
newPreemptibleStateActivity Source #
:: Bool | whether the activity can be preempted |
-> (s -> a -> Process (s, b)) | provide a new state and output by the specified old state and input |
-> s | the initial state |
-> Simulation (Activity s a b) |
Create a new activity that can provide output b
by input a
starting from state s
.
Processing
activityNet :: Activity s a b -> Net a b Source #
Return a network computation for the specified activity.
The computation updates the internal state of the activity. The usual case is when the computation is applied only once in a chain of data processing. Otherwise; every time the computation is used, the state of the activity changes. Sometimes it can be indeed useful if you want to aggregate the statistics for different activities simultaneously, but it would be more preferable to avoid this.
If you connect different activity computations returned by this function in a chain
with help of >>>
or other category combinator then this chain will act as one
whole, where the first activity will take a new task only after the last activity
finishes its current task and requests for the next one from the previous activity
in the chain. This is not always that thing you might need.
Activity Properties
activityInitState :: Activity s a b -> s Source #
The initial state of the activity.
activityState :: Activity s a b -> Event s Source #
Return the current state of the activity.
See also activityStateChanged
and activityStateChanged_
.
activityTotalUtilisationTime :: Activity s a b -> Event Double Source #
Return the counted total time when the activity was utilised.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityTotalUtilisationTimeChanged
and activityTotalUtilisationTimeChanged_
.
activityTotalIdleTime :: Activity s a b -> Event Double Source #
Return the counted total time when the activity was idle.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityTotalIdleTimeChanged
and activityTotalIdleTimeChanged_
.
activityTotalPreemptionTime :: Activity s a b -> Event Double Source #
Return the counted total time when the activity was preemted waiting for the further proceeding.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityTotalPreemptionTimeChanged
and activityTotalPreemptionTimeChanged_
.
activityUtilisationTime :: Activity s a b -> Event (SamplingStats Double) Source #
Return the statistics for the time when the activity was utilised.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityUtilisationTimeChanged
and activityUtilisationTimeChanged_
.
activityIdleTime :: Activity s a b -> Event (SamplingStats Double) Source #
Return the statistics for the time when the activity was idle.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityIdleTimeChanged
and activityIdleTimeChanged_
.
activityPreemptionTime :: Activity s a b -> Event (SamplingStats Double) Source #
Return the statistics for the time when the activity was preempted waiting for the further proceeding.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityPreemptionTimeChanged
and activityPreemptionTimeChanged_
.
activityUtilisationFactor :: Activity s a b -> Event Double Source #
It returns the factor changing from 0 to 1, which estimates how often the activity was utilised.
This factor is calculated as
totalUtilisationTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityUtilisationFactorChanged
and activityUtilisationFactorChanged_
.
activityIdleFactor :: Activity s a b -> Event Double Source #
It returns the factor changing from 0 to 1, which estimates how often the activity was idle.
This factor is calculated as
totalIdleTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityIdleFactorChanged
and activityIdleFactorChanged_
.
activityPreemptionFactor :: Activity s a b -> Event Double Source #
It returns the factor changing from 0 to 1, which estimates how often the activity was preempted waiting for the further proceeding.
This factor is calculated as
totalUtilisationTime / (totalUtilisationTime + totalIdleTime + totalPreemptionTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also activityPreemptionFactorChanged
and activityPreemptionFactorChanged_
.
Statistics Reset
resetActivity :: Activity s a b -> Event () Source #
Reset the statistics.
Summary
activitySummary :: Activity s a b -> Int -> Event ShowS Source #
Return the summary for the activity with desciption of its properties using the specified indent.
Derived Signals for Properties
activityStateChanged :: Activity s a b -> Signal s Source #
Signal when the activityState
property value has changed.
activityStateChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityState
property value has changed.
activityTotalUtilisationTimeChanged :: Activity s a b -> Signal Double Source #
Signal when the activityTotalUtilisationTime
property value has changed.
activityTotalUtilisationTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityTotalUtilisationTime
property value has changed.
activityTotalIdleTimeChanged :: Activity s a b -> Signal Double Source #
Signal when the activityTotalIdleTime
property value has changed.
activityTotalIdleTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityTotalIdleTime
property value has changed.
activityTotalPreemptionTimeChanged :: Activity s a b -> Signal Double Source #
Signal when the activityTotalPreemptionTime
property value has changed.
activityTotalPreemptionTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityTotalPreemptionTime
property value has changed.
activityUtilisationTimeChanged :: Activity s a b -> Signal (SamplingStats Double) Source #
Signal when the activityUtilisationTime
property value has changed.
activityUtilisationTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityUtilisationTime
property value has changed.
activityIdleTimeChanged :: Activity s a b -> Signal (SamplingStats Double) Source #
Signal when the activityIdleTime
property value has changed.
activityIdleTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityIdleTime
property value has changed.
activityPreemptionTimeChanged :: Activity s a b -> Signal (SamplingStats Double) Source #
Signal when the activityPreemptionTime
property value has changed.
activityPreemptionTimeChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityPreemptionTime
property value has changed.
activityUtilisationFactorChanged :: Activity s a b -> Signal Double Source #
Signal when the activityUtilisationFactor
property value has changed.
activityUtilisationFactorChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityUtilisationFactor
property value has changed.
activityIdleFactorChanged :: Activity s a b -> Signal Double Source #
Signal when the activityIdleFactor
property value has changed.
activityIdleFactorChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityIdleFactor
property value has changed.
activityPreemptionFactorChanged :: Activity s a b -> Signal Double Source #
Signal when the activityPreemptionFactor
property value has changed.
activityPreemptionFactorChanged_ :: Activity s a b -> Signal () Source #
Signal when the activityPreemptionFactor
property value has changed.
Basic Signals
activityUtilising :: Activity s a b -> Signal a Source #
Raised when starting to utilise the activity after a new input task is received.
activityUtilised :: Activity s a b -> Signal (a, b) Source #
Raised when the activity has been utilised after the current task is processed.
activityPreemptionBeginning :: Activity s a b -> Signal a Source #
Raised when the activity utilisation was preempted.
activityPreemptionEnding :: Activity s a b -> Signal a Source #
Raised when the activity utilisation was proceeded after it had been preempted earlier.
Overall Signal
activityChanged_ :: Activity s a b -> Signal () Source #
Signal whenever any property of the activity changes.