diff --git a/Src/PChecker/CheckerCore/CheckerConfiguration.cs b/Src/PChecker/CheckerCore/CheckerConfiguration.cs
index bcb09e5977..bc296da11c 100644
--- a/Src/PChecker/CheckerCore/CheckerConfiguration.cs
+++ b/Src/PChecker/CheckerCore/CheckerConfiguration.cs
@@ -286,11 +286,6 @@ public int MaxSchedulingSteps
[DataMember]
public string JvmArgs;
- ///
- /// Enable conflict analysis for scheduling optimization.
- ///
- [DataMember]
- public bool EnableConflictAnalysis;
///
/// Initializes a new instance of the class.
@@ -337,7 +332,6 @@ protected CheckerConfiguration()
EnableColoredConsoleOutput = false;
DisableEnvironmentExit = true;
- EnableConflictAnalysis = false;
PSymArgs = "";
JvmArgs = "";
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/ConflictOpMonitor.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/ConflictOpMonitor.cs
deleted file mode 100644
index 00cef43310..0000000000
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/ConflictOpMonitor.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using PChecker.Actors;
-using PChecker.Actors.Events;
-using PChecker.Actors.Logging;
-using PChecker.SystematicTesting.Operations;
-
-namespace PChecker.Feedback;
-
-
-internal class ConflictOpMonitor: ActorRuntimeLogBase
-{
-
- public VectorClockGenerator VectorClockGenerator;
-
- // This dictionary stores all operations received by a machine.
- // Each operation is labeled with ActorId, source location, and its corresponding
- // vector clock timestamp.
- private Dictionary)>> incomingOps = new();
-
- private Dictionary> conflictOps = new();
-
- public override void OnSendEvent(ActorId targetActorId, string senderName, string senderType, string senderStateName, Event e,
- Guid opGroupId, bool isTargetHalted)
- {
- var receiverKey = e.Receiver;
- var senderKey = e.Sender;
- var currentOp = new Operation(senderKey, receiverKey, e.Loc);
- if (!incomingOps.ContainsKey(receiverKey))
- {
- incomingOps.Add(receiverKey, new HashSet<(Operation, Dictionary)>());
- }
- var opsSet = incomingOps[receiverKey];
-
-
-
- if (VectorClockGenerator.ContextVcMap.TryGetValue(senderKey, out var vectorClock))
- {
-
- foreach (var op in opsSet)
- {
- if (op.Item1.Sender == currentOp.Sender)
- {
- continue;
- }
-
- if (!IsLEQ(op.Item2, vectorClock) && !IsLEQ(vectorClock, op.Item2))
- {
- AddConflictOp(op.Item1, currentOp);
- }
- }
- opsSet.Add((currentOp, vectorClock
- .ToDictionary(entry => entry.Key, entry => entry.Value)));
- }
- }
-
- internal bool IsRacing(AsyncOperation op1, AsyncOperation op2)
- {
- if (op1.Type != AsyncOperationType.Send || op2.Type != AsyncOperationType.Send) {
- return false;
- }
-
- var operation1 = new Operation(op1.Name, op1.LastSentReceiver, op1.LastEvent!.Loc);
- var operation2 = new Operation(op2.Name, op2.LastSentReceiver, op2.LastEvent!.Loc);
-
- if (conflictOps.TryGetValue(operation1, out var ops)) {
- return ops.Contains(operation2);
- }
- return false;
- }
-
- public void Reset() {
- incomingOps.Clear();
- }
-
- bool IsLEQ(Dictionary vc1, Dictionary vc2)
- {
- foreach (var key in vc1.Keys.Union(vc2.Keys))
- {
- var op1 = vc1.GetValueOrDefault(key, 0);
- var op2 = vc2.GetValueOrDefault(key, 0);
- if (op1 > op2)
- {
- return false;
- }
- }
- return true;
- }
-
- void AddConflictOp(Operation op1, Operation op2)
- {
- if (!conflictOps.ContainsKey(op1)) {
- conflictOps[op1] = new HashSet();
- }
- if (!conflictOps.ContainsKey(op2)) {
- conflictOps[op2] = new HashSet();
- }
- conflictOps[op1].Add(op2);
- conflictOps[op2].Add(op1);
- }
- internal bool IsConflictingOp(AsyncOperation op)
- {
- if (op.Type != AsyncOperationType.Send) {
- return false;
- }
-
- var operation = new Operation(op.Name, op.LastSentReceiver, op.LastEvent!.Loc);
- if (conflictOps.TryGetValue(operation, out var ops ))
- {
- return ops.Count != 0;
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/Mutator/POSScheduleMutator.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/Mutator/POSScheduleMutator.cs
index d94b042661..b375093a0f 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/Mutator/POSScheduleMutator.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/Mutator/POSScheduleMutator.cs
@@ -9,8 +9,6 @@ public POSScheduleGenerator Mutate(POSScheduleGenerator prev)
{
return new POSScheduleGenerator(prev.Random,
Utils.MutateRandomChoices(prev.PriorityChoices, _meanMutationCount, _meanMutationSize, _random),
- Utils.MutateRandomChoices(prev.SwitchPointChoices, _meanMutationCount, _meanMutationSize, _random),
- prev.Monitor
- );
+ Utils.MutateRandomChoices(prev.SwitchPointChoices, _meanMutationCount, _meanMutationSize, _random));
}
}
\ No newline at end of file
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/POSScheduleGenerator.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/POSScheduleGenerator.cs
index fffc0ba15d..b3de2b2db1 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/POSScheduleGenerator.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Feedback/Generator/POSScheduleGenerator.cs
@@ -13,25 +13,21 @@ internal class POSScheduleGenerator: POSScheduler, IScheduleGenerator PriorityChoices;
public RandomChoices SwitchPointChoices;
- public ConflictOpMonitor? Monitor;
- public POSScheduleGenerator(System.Random random, RandomChoices? priorityChoices, RandomChoices? switchPointChoices,
- ConflictOpMonitor? monitor):
+ public POSScheduleGenerator(System.Random random, RandomChoices? priorityChoices, RandomChoices? switchPointChoices):
base(new ParametricProvider(
priorityChoices != null ? new RandomChoices(priorityChoices) : new RandomChoices(random),
- switchPointChoices != null ? new RandomChoices(switchPointChoices) : new RandomChoices(random)),
- monitor)
+ switchPointChoices != null ? new RandomChoices(switchPointChoices) : new RandomChoices(random)))
{
Random = random;
var provider = (ParametricProvider) Provider;
PriorityChoices = provider.PriorityChoices;
SwitchPointChoices = provider.SwitchPointChoices;
- Monitor = monitor;
}
- public POSScheduleGenerator(CheckerConfiguration checkerConfiguration, ConflictOpMonitor? monitor):
+ public POSScheduleGenerator(CheckerConfiguration checkerConfiguration):
this(new System.Random((int?)checkerConfiguration.RandomGeneratorSeed ?? Guid.NewGuid().GetHashCode()), null,
- null, monitor)
+ null)
{
}
@@ -42,12 +38,12 @@ public POSScheduleGenerator Mutate()
public POSScheduleGenerator New()
{
- return new POSScheduleGenerator(Random, null, null, Monitor);
+ return new POSScheduleGenerator(Random, null, null);
}
public POSScheduleGenerator Copy()
{
- return new POSScheduleGenerator(Random, PriorityChoices, SwitchPointChoices, Monitor);
+ return new POSScheduleGenerator(Random, PriorityChoices, SwitchPointChoices);
}
public AsyncOperation? NextRandomOperation(List enabledOperations, AsyncOperation current)
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/POSScheduler.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/POSScheduler.cs
index 589ae13099..ae44bbec13 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/POSScheduler.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/POSScheduler.cs
@@ -15,17 +15,14 @@ internal class POSScheduler: PrioritizedScheduler
/// List of prioritized operations.
///
private readonly List PrioritizedOperations;
-
- public ConflictOpMonitor? ConflictOpMonitor;
-
+
///
/// Initializes a new instance of the class.
///
- public POSScheduler(PriorizationProvider provider, ConflictOpMonitor? monitor)
+ public POSScheduler(PriorizationProvider provider)
{
Provider = provider;
PrioritizedOperations = new List();
- ConflictOpMonitor = monitor;
}
public bool GetNextOperation(AsyncOperation current, IEnumerable ops, out AsyncOperation next)
@@ -123,11 +120,6 @@ private AsyncOperation GetPrioritizedOperation(List ops, AsyncOp
private bool FindNonRacingOperation(IEnumerable ops, out AsyncOperation next)
{
var nonRacingOps = ops.Where(op => op.Type != AsyncOperationType.Send);
- if (!nonRacingOps.Any() && ConflictOpMonitor != null)
- {
- nonRacingOps = ops.Where(op => !ConflictOpMonitor.IsConflictingOp(op));
- }
-
if (!nonRacingOps.Any())
{
next = null;
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/PriorizationSchedulingBase.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/PriorizationSchedulingBase.cs
index 3894b96fc8..ae4eee7531 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/PriorizationSchedulingBase.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/PriorizationSchedulingBase.cs
@@ -34,21 +34,19 @@ internal class PriorizationSchedulingBase
///
private readonly List PrioritizedOperations;
- public ConflictOpMonitor? ConflictOpMonitor;
private int _nextPriorityChangePoint;
private int _numSwitchPointsLeft;
///
/// Initializes a new instance of the class.
///
- public PriorizationSchedulingBase(int maxPrioritySwitchPoints, int scheduleLength, PriorizationProvider provider, ConflictOpMonitor? monitor)
+ public PriorizationSchedulingBase(int maxPrioritySwitchPoints, int scheduleLength, PriorizationProvider provider)
{
Provider = provider;
ScheduledSteps = 0;
ScheduleLength = scheduleLength;
MaxPrioritySwitchPoints = maxPrioritySwitchPoints;
PrioritizedOperations = new List();
- ConflictOpMonitor = monitor;
_numSwitchPointsLeft = maxPrioritySwitchPoints;
double switchPointProbability = 0.1;
@@ -66,7 +64,7 @@ public virtual bool GetNextOperation(AsyncOperation current, IEnumerable op.Status is AsyncOperationStatus.Enabled).ToList();
if (enabledOperations.Count == 0)
{
- if (ConflictOpMonitor == null && _nextPriorityChangePoint == ScheduledSteps)
+ if (_nextPriorityChangePoint == ScheduledSteps)
{
MovePriorityChangePointForward();
}
@@ -78,25 +76,9 @@ public virtual bool GetNextOperation(AsyncOperation current, IEnumerable ops)
- {
- foreach (var op in ops)
- {
- if (op != next && ConflictOpMonitor.IsRacing(next, op))
- {
- PrioritizedOperations.Remove(op);
- }
- }
- PrioritizedOperations.Remove(next);
- }
private void MovePriorityChangePointForward()
{
@@ -137,13 +119,8 @@ private AsyncOperation GetPrioritizedOperation(List ops, AsyncOp
Debug.WriteLine(" Detected new operation '{0}' at index '{1}'.", op.Id, mIndex);
}
- if (ConflictOpMonitor != null && FindNonRacingOperation(ops, out var next))
- {
- return next;
- }
-
var prioritizedSchedulable = GetHighestPriorityEnabledOperation(ops);
- if (ConflictOpMonitor == null && _nextPriorityChangePoint == ScheduledSteps)
+ if (_nextPriorityChangePoint == ScheduledSteps)
{
if (ops.Count == 1)
{
@@ -190,32 +167,6 @@ private AsyncOperation GetPrioritizedOperation(List ops, AsyncOp
return ops.First(op => op.Equals(prioritizedSchedulable));
}
- private bool FindNonRacingOperation(IEnumerable ops, out AsyncOperation next)
- {
- var nonRacingOps = ops.Where(op => op.Type != AsyncOperationType.Send);
- if (!nonRacingOps.Any())
- {
- var sendOps = ops.Where(op => op.Type == AsyncOperationType.Send);
- nonRacingOps = ops.Where(op => !ConflictOpMonitor.IsConflictingOp(op));
- }
-
- if (!nonRacingOps.Any())
- {
- next = null;
- return false;
- }
- else if (!nonRacingOps.Skip(1).Any())
- {
- next = nonRacingOps.First();
- return true;
- }
- else
- {
- next = GetHighestPriorityEnabledOperation(nonRacingOps);
- return true;
- }
-
- }
public void Reset()
{
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs b/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
index d226141c10..d15d8316d4 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
@@ -65,11 +65,6 @@ public class TestingEngine
///
internal readonly ISchedulingStrategy Strategy;
- ///
- /// Monitors conflict operations used by the POS Strategy.
- ///
- private ConflictOpMonitor? _conflictOpObserver;
-
///
/// Random value generator used by the scheduling strategies.
///
@@ -303,12 +298,6 @@ private TestingEngine(CheckerConfiguration checkerConfiguration, TestMethodInfo
{
JsonVerboseLogs = new List>();
}
-
- if (checkerConfiguration.EnableConflictAnalysis)
- {
- _conflictOpObserver = new ConflictOpMonitor();
- }
-
if (checkerConfiguration.SchedulingStrategy is "replay")
{
var scheduleDump = GetScheduleForReplay(out var isFair);
@@ -328,8 +317,7 @@ private TestingEngine(CheckerConfiguration checkerConfiguration, TestMethodInfo
}
else if (checkerConfiguration.SchedulingStrategy is "pos")
{
- var scheduler = new POSScheduler(new RandomPriorizationProvider(RandomValueGenerator),
- _conflictOpObserver);
+ var scheduler = new POSScheduler(new RandomPriorizationProvider(RandomValueGenerator));
Strategy = new PrioritizedSchedulingStrategy(checkerConfiguration.MaxUnfairSchedulingSteps,
RandomValueGenerator, scheduler);
}
@@ -372,7 +360,7 @@ private TestingEngine(CheckerConfiguration checkerConfiguration, TestMethodInfo
Strategy = new FeedbackGuidedStrategy(
_checkerConfiguration,
new RandomInputGenerator(checkerConfiguration),
- new POSScheduleGenerator(_checkerConfiguration, _conflictOpObserver));
+ new POSScheduleGenerator(_checkerConfiguration));
}
else if (checkerConfiguration.SchedulingStrategy is "portfolio")
{
@@ -568,12 +556,6 @@ private void RegisterObservers(ControlledRuntime runtime)
// Always output a json log of the error
JsonLogger = new JsonWriter();
runtime.SetJsonLogger(JsonLogger);
-
- if (_conflictOpObserver != null)
- {
- _conflictOpObserver.VectorClockGenerator = JsonLogger.VcGenerator;
- runtime.RegisterLog(_conflictOpObserver);
- }
}
///
@@ -716,7 +698,6 @@ private void RunNextIteration(int schedule)
runtimeLogger?.Dispose();
runtime?.Dispose();
- _conflictOpObserver?.Reset();
}
}
diff --git a/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs b/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
index 407321454d..6b62e9f69d 100644
--- a/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
+++ b/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
@@ -81,7 +81,6 @@ internal PCheckerOptions()
advancedGroup.AddArgument("xml-trace", null, "Specify a filename for XML runtime log output to be written to", typeof(bool));
advancedGroup.AddArgument("psym-args", null, "Specify a concatenated list of additional PSym-specific arguments to pass, each starting with a colon").IsHidden = true;
advancedGroup.AddArgument("jvm-args", null, "Specify a concatenated list of PSym-specific JVM arguments to pass, each starting with a colon").IsHidden = true;
- advancedGroup.AddArgument("conflict-analysis", null, "Enable POS conflict analysis.", typeof(bool));
}
///
@@ -327,9 +326,6 @@ private static void UpdateConfigurationWithParsedArgument(CheckerConfiguration c
case "jvm-args":
checkerConfiguration.JvmArgs = ((string)option.Value).Replace(':', ' ');
break;
- case "conflict-analysis":
- checkerConfiguration.EnableConflictAnalysis = true;
- break;
case "pproj":
// do nothing, since already configured through UpdateConfigurationWithPProjectFile
break;