dejafu-2.3.0.1: A library for unit-testing concurrent programs.

Copyright(c) 2015--2019 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
PortabilityDeriveAnyClass, DeriveGeneric
Safe HaskellNone
LanguageHaskell2010

Test.DejaFu.SCT.Internal.Weighted

Contents

Description

Internal types and functions for SCT via weighted random scheduling. This module is NOT considered to form part of the public interface of this library.

Synopsis

Weighted random scheduler

data RandSchedState g Source #

The scheduler state

Constructors

RandSchedState 

Fields

Instances
Eq g => Eq (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Show g => Show (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Generic (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Associated Types

type Rep (RandSchedState g) :: Type -> Type #

NFData g => NFData (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Methods

rnf :: RandSchedState g -> () #

type Rep (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

type Rep (RandSchedState g) = D1 (MetaData "RandSchedState" "Test.DejaFu.SCT.Internal.Weighted" "dejafu-2.3.0.1-BzDXi8aNz9dB39Eb2xnbiy" False) (C1 (MetaCons "RandSchedState" PrefixI True) (S1 (MetaSel (Just "schedWeights") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ThreadId Int)) :*: (S1 (MetaSel (Just "schedLengthBound") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe LengthBound)) :*: S1 (MetaSel (Just "schedGen") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 g))))

initialRandSchedState :: Maybe LengthBound -> g -> RandSchedState g Source #

Initial weighted random scheduler state.

randSched :: RandomGen g => (g -> (Int, g)) -> Scheduler (RandSchedState g) Source #

Weighted random scheduler: assigns to each new thread a weight, and makes a weighted random choice out of the runnable threads at every step.