Copyright | Copyright (c) 2009-2013, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Tested with: GHC 7.6.3
It models the server that prodives a service.
- data Server s a b
- newServer :: (a -> Process b) -> Simulation (Server () a b)
- newServerWithState :: s -> ((s, a) -> Process (s, b)) -> Simulation (Server s a b)
- serverProcessor :: Server s a b -> Processor a b
- serverInitState :: Server s a b -> s
- serverState :: Server s a b -> Event s
- serverTotalInputTime :: Server s a b -> Event Double
- serverTotalProcessingTime :: Server s a b -> Event Double
- serverTotalOutputTime :: Server s a b -> Event Double
- serverInputTime :: Server s a b -> Event (SamplingStats Double)
- serverProcessingTime :: Server s a b -> Event (SamplingStats Double)
- serverOutputTime :: Server s a b -> Event (SamplingStats Double)
- serverInputTimeFactor :: Server s a b -> Event Double
- serverProcessingTimeFactor :: Server s a b -> Event Double
- serverOutputTimeFactor :: Server s a b -> Event Double
- serverSummary :: Server s a b -> Int -> Event ShowS
- serverStateChanged :: Server s a b -> Signal s
- serverStateChanged_ :: Server s a b -> Signal ()
- serverTotalInputTimeChanged :: Server s a b -> Signal Double
- serverTotalInputTimeChanged_ :: Server s a b -> Signal ()
- serverTotalProcessingTimeChanged :: Server s a b -> Signal Double
- serverTotalProcessingTimeChanged_ :: Server s a b -> Signal ()
- serverTotalOutputTimeChanged :: Server s a b -> Signal Double
- serverTotalOutputTimeChanged_ :: Server s a b -> Signal ()
- serverInputTimeChanged :: Server s a b -> Signal (SamplingStats Double)
- serverInputTimeChanged_ :: Server s a b -> Signal ()
- serverProcessingTimeChanged :: Server s a b -> Signal (SamplingStats Double)
- serverProcessingTimeChanged_ :: Server s a b -> Signal ()
- serverOutputTimeChanged :: Server s a b -> Signal (SamplingStats Double)
- serverOutputTimeChanged_ :: Server s a b -> Signal ()
- serverInputTimeFactorChanged :: Server s a b -> Signal Double
- serverInputTimeFactorChanged_ :: Server s a b -> Signal ()
- serverProcessingTimeFactorChanged :: Server s a b -> Signal Double
- serverProcessingTimeFactorChanged_ :: Server s a b -> Signal ()
- serverOutputTimeFactorChanged :: Server s a b -> Signal Double
- serverOutputTimeFactorChanged_ :: Server s a b -> Signal ()
- serverInputReceived :: Server s a b -> Signal a
- serverTaskProcessed :: Server s a b -> Signal (a, b)
- serverOutputProvided :: Server s a b -> Signal (a, b)
- serverChanged_ :: Server s a b -> Signal ()
Server
:: (a -> Process b) | provide an output by the specified input |
-> Simulation (Server () a b) |
Create a new server that can provide output b
by input a
.
Also it returns the corresponded processor that being applied
updates the server state.
:: s | the initial state |
-> ((s, a) -> Process (s, b)) | provide an output by the specified input and update the state |
-> Simulation (Server s a b) |
Create a new server that can provide output b
by input a
starting from state s
. Also it returns the corresponded processor
that being applied updates the server state.
Processing
serverProcessor :: Server s a b -> Processor a b Source
Return a processor for the specified server.
The processor updates the internal state of the server. The usual case is when the processor is applied only once in a chain of data processing. Otherwise; every time the processor is used, the state of the server changes.
Server Properties and Activities
serverInitState :: Server s a b -> s Source
The initial state of the server.
serverState :: Server s a b -> Event s Source
Return the current state of the server.
See also serverStateChanged
and serverStateChanged_
.
serverTotalInputTime :: Server s a b -> Event Double Source
Return the counted total time spent by the server in awaiting the input.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverTotalInputTimeChanged
and serverTotalInputTimeChanged_
.
serverTotalProcessingTime :: Server s a b -> Event Double Source
Return the counted total time spent by the server to process all tasks.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverTotalProcessingTimeChanged
and serverTotalProcessingTimeChanged_
.
serverTotalOutputTime :: Server s a b -> Event Double Source
Return the counted total time when the server was in the lock state trying to deliver the output.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverTotalOutputTimeChanged
and serverTotalOutputTimeChanged_
.
serverInputTime :: Server s a b -> Event (SamplingStats Double) Source
Return the statistics of the time spent by the server in awaiting the input.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverInputTimeChanged
and serverInputTimeChanged_
.
serverProcessingTime :: Server s a b -> Event (SamplingStats Double) Source
Return the statistics of the time spent by the server to process the tasks.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverProcessingTimeChanged
and serverProcessingTimeChanged_
.
serverOutputTime :: Server s a b -> Event (SamplingStats Double) Source
Return the statistics of the time when the server was in the lock state trying to deliver the output.
The value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverOutputTimeChanged
and serverOutputTimeChanged_
.
serverInputTimeFactor :: Server s a b -> Event Double Source
It returns the factor changing from 0 to 1, which estimates how often the server was awaiting for the next input task.
This factor is calculated as
totalInputTime / (totalInputTime + totalProcessingTime + totalOutputTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverInputTimeFactorChanged
and serverInputTimeFactorChanged_
.
serverProcessingTimeFactor :: Server s a b -> Event Double Source
It returns the factor changing from 0 to 1, which estimates how often the server was busy with direct processing its tasks.
This factor is calculated as
totalProcessingTime / (totalInputTime + totalProcessingTime + totalOutputTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverProcessingTimeFactorChanged
and serverProcessingTimeFactorChanged_
.
serverOutputTimeFactor :: Server s a b -> Event Double Source
It returns the factor changing from 0 to 1, which estimates how often the server was locked trying to deliver the output after the task is finished.
This factor is calculated as
totalOutputTime / (totalInputTime + totalProcessingTime + totalOutputTime)
As before in this module, the value returned changes discretely and it is usually delayed relative to the current simulation time.
See also serverOutputTimeFactorChanged
and serverOutputTimeFactorChanged_
.
Summary
serverSummary :: Server s a b -> Int -> Event ShowS Source
Return the summary for the server with desciption of its properties and activities using the specified indent.
Derived Signals for Properties
serverStateChanged :: Server s a b -> Signal s Source
Signal when the serverState
property value has changed.
serverStateChanged_ :: Server s a b -> Signal () Source
Signal when the serverState
property value has changed.
serverTotalInputTimeChanged :: Server s a b -> Signal Double Source
Signal when the serverTotalInputTime
property value has changed.
serverTotalInputTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverTotalInputTime
property value has changed.
serverTotalProcessingTimeChanged :: Server s a b -> Signal Double Source
Signal when the serverTotalProcessingTime
property value has changed.
serverTotalProcessingTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverTotalProcessingTime
property value has changed.
serverTotalOutputTimeChanged :: Server s a b -> Signal Double Source
Signal when the serverTotalOutputTime
property value has changed.
serverTotalOutputTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverTotalOutputTime
property value has changed.
serverInputTimeChanged :: Server s a b -> Signal (SamplingStats Double) Source
Signal when the serverInputTime
property value has changed.
serverInputTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverInputTime
property value has changed.
serverProcessingTimeChanged :: Server s a b -> Signal (SamplingStats Double) Source
Signal when the serverProcessingTime
property value has changed.
serverProcessingTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverProcessingTime
property value has changed.
serverOutputTimeChanged :: Server s a b -> Signal (SamplingStats Double) Source
Signal when the serverOutputTime
property value has changed.
serverOutputTimeChanged_ :: Server s a b -> Signal () Source
Signal when the serverOutputTime
property value has changed.
serverInputTimeFactorChanged :: Server s a b -> Signal Double Source
Signal when the serverInputTimeFactor
property value has changed.
serverInputTimeFactorChanged_ :: Server s a b -> Signal () Source
Signal when the serverInputTimeFactor
property value has changed.
serverProcessingTimeFactorChanged :: Server s a b -> Signal Double Source
Signal when the serverProcessingTimeFactor
property value has changed.
serverProcessingTimeFactorChanged_ :: Server s a b -> Signal () Source
Signal when the serverProcessingTimeFactor
property value has changed.
serverOutputTimeFactorChanged :: Server s a b -> Signal Double Source
Signal when the serverOutputTimeFactor
property value has changed.
serverOutputTimeFactorChanged_ :: Server s a b -> Signal () Source
Signal when the serverOutputTimeFactor
property value has changed.
Basic Signals
serverInputReceived :: Server s a b -> Signal a Source
Raised when the server receives a new input task.
serverTaskProcessed :: Server s a b -> Signal (a, b) Source
Raised when the server has just processed the task.
serverOutputProvided :: Server s a b -> Signal (a, b) Source
Raised when the server has just delivered the output.
Overall Signal
serverChanged_ :: Server s a b -> Signal () Source
Signal whenever any property of the server changes.