dejafu-2.4.0.5: A library for unit-testing concurrent programs.
Copyright(c) 2015--2019 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
PortabilityDeriveAnyClass, DeriveGeneric
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.DejaFu.SCT.Internal.Weighted

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

Instances details
Generic (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Associated Types

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

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

Defined in Test.DejaFu.SCT.Internal.Weighted

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

Defined in Test.DejaFu.SCT.Internal.Weighted

Methods

rnf :: RandSchedState g -> () #

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

Defined in Test.DejaFu.SCT.Internal.Weighted

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.4.0.5-G4EEj1kXZBX5wEYbPUnAst" '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.