/// <summary> /// Initializes a new instance of the <see cref="OperationScheduler"/> class. /// </summary> private OperationScheduler(Configuration configuration) { this.Configuration = configuration; this.SchedulingPolicy = configuration.IsConcurrencyFuzzingEnabled ? SchedulingPolicy.Fuzzing : SchedulingPolicy.Systematic; this.ValueGenerator = new RandomValueGenerator(configuration); if (!configuration.UserExplicitlySetLivenessTemperatureThreshold && configuration.MaxFairSchedulingSteps > 0) { configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2; } if (this.SchedulingPolicy is SchedulingPolicy.Systematic) { this.Strategy = SystematicStrategy.Create(configuration, this.ValueGenerator); if (this.Strategy is ReplayStrategy replayStrategy) { this.ReplayStrategy = replayStrategy; this.IsReplayingSchedule = true; } } else if (this.SchedulingPolicy is SchedulingPolicy.Fuzzing) { this.Strategy = FuzzingStrategy.Create(configuration, this.ValueGenerator); } }
/// <summary> /// Initializes a new instance of the <see cref="OperationScheduler"/> class. /// </summary> private OperationScheduler(SchedulingPolicy policy, IRandomValueGenerator valueGenerator, Configuration configuration) { this.Configuration = configuration; this.SchedulingPolicy = policy; this.ValueGenerator = valueGenerator; if (!configuration.UserExplicitlySetLivenessTemperatureThreshold && configuration.MaxFairSchedulingSteps > 0) { configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2; } if (this.SchedulingPolicy is SchedulingPolicy.Systematic) { this.Strategy = SystematicStrategy.Create(configuration, this.ValueGenerator); if (this.Strategy is ReplayStrategy replayStrategy) { this.ReplayStrategy = replayStrategy; this.IsReplayingSchedule = true; } // Wrap the strategy inside a liveness checking strategy. if (this.Configuration.IsLivenessCheckingEnabled) { this.Strategy = new TemperatureCheckingStrategy(this.Configuration, this.Strategy as SystematicStrategy); } } else if (this.SchedulingPolicy is SchedulingPolicy.Fuzzing) { this.Strategy = FuzzingStrategy.Create(configuration, this.ValueGenerator); } }