Copyright | (c) 2017 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- decrementYieldLimit :: SVar t m a -> IO Bool
- incrementYieldLimit :: SVar t m a -> IO ()
- decrementBufferLimit :: SVar t m a -> IO ()
- incrementBufferLimit :: SVar t m a -> IO ()
- resetBufferLimit :: SVar t m a -> IO ()
- data Work
- isBeyondMaxRate :: SVar t m a -> YieldRateInfo -> IO Bool
- estimateWorkers :: Limit -> Count -> Count -> NanoSecond64 -> NanoSecond64 -> NanoSecond64 -> LatencyRange -> Work
- updateYieldCount :: WorkerInfo -> IO Count
- minThreadDelay :: NanoSecond64
- workerRateControl :: SVar t m a -> YieldRateInfo -> WorkerInfo -> IO Bool
- workerUpdateLatency :: YieldRateInfo -> WorkerInfo -> IO ()
- send :: SVar t m a -> ChildEvent a -> IO Int
- ringDoorBell :: SVar t m a -> IO ()
- sendYield :: SVar t m a -> Maybe WorkerInfo -> ChildEvent a -> IO Bool
- sendToProducer :: SVar t m a -> ChildEvent a -> IO Int
- sendStop :: SVar t m a -> Maybe WorkerInfo -> IO ()
- sendStopToProducer :: MonadIO m => SVar t m a -> m ()
- handleChildException :: SVar t m a -> SomeException -> IO ()
- handleFoldException :: SVar t m a -> SomeException -> IO ()
Adjusting Limits
incrementYieldLimit :: SVar t m a -> IO () Source #
decrementBufferLimit :: SVar t m a -> IO () Source #
incrementBufferLimit :: SVar t m a -> IO () Source #
resetBufferLimit :: SVar t m a -> IO () Source #
Rate Control
isBeyondMaxRate :: SVar t m a -> YieldRateInfo -> IO Bool Source #
estimateWorkers :: Limit -> Count -> Count -> NanoSecond64 -> NanoSecond64 -> NanoSecond64 -> LatencyRange -> Work Source #
updateYieldCount :: WorkerInfo -> IO Count Source #
minThreadDelay :: NanoSecond64 Source #
This is a magic number and it is overloaded, and used at several places to achieve batching:
- If we have to sleep to slowdown this is the minimum period that we accumulate before we sleep. Also, workers do not stop until this much sleep time is accumulated.
- Collected latencies are computed and transferred to measured latency after a minimum of this period.
workerRateControl :: SVar t m a -> YieldRateInfo -> WorkerInfo -> IO Bool Source #
workerUpdateLatency :: YieldRateInfo -> WorkerInfo -> IO () Source #
Send Events
send :: SVar t m a -> ChildEvent a -> IO Int Source #
This function is used by the producer threads to queue output for the consumer thread to consume. Returns whether the queue has more space.
ringDoorBell :: SVar t m a -> IO () Source #
Yield
sendYield :: SVar t m a -> Maybe WorkerInfo -> ChildEvent a -> IO Bool Source #
sendToProducer :: SVar t m a -> ChildEvent a -> IO Int Source #
Stop
sendStopToProducer :: MonadIO m => SVar t m a -> m () Source #
Exception
handleChildException :: SVar t m a -> SomeException -> IO () Source #
handleFoldException :: SVar t m a -> SomeException -> IO () Source #