From 7348a19be5556eaf7bf660062da428dd07e21215 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Sun, 12 Apr 2020 00:21:43 -0700 Subject: [PATCH] Adding a counter for number of conflicts. --- src/main/gov/nasa/jpf/listener/DPORStateReducer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/gov/nasa/jpf/listener/DPORStateReducer.java b/src/main/gov/nasa/jpf/listener/DPORStateReducer.java index a352864..22cc82f 100644 --- a/src/main/gov/nasa/jpf/listener/DPORStateReducer.java +++ b/src/main/gov/nasa/jpf/listener/DPORStateReducer.java @@ -88,7 +88,8 @@ public class DPORStateReducer extends ListenerAdapter { private boolean isEndOfExecution; // Statistics - private int numOfTransitions; + private int numOfConflicts; + private int numOfTransitions; public DPORStateReducer(Config config, JPF jpf) { verboseMode = config.getBoolean("printout_state_transition", false); @@ -99,6 +100,7 @@ public class DPORStateReducer extends ListenerAdapter { out = null; } isBooleanCGFlipped = false; + numOfConflicts = 0; numOfTransitions = 0; restorableStateMap = new HashMap<>(); initializeStatesVariables(); @@ -165,9 +167,14 @@ public class DPORStateReducer extends ListenerAdapter { @Override public void searchFinished(Search search) { + if (stateReductionMode) { + // Number of conflicts = first trace + subsequent backtrack points + numOfConflicts += 1 + doneBacktrackSet.size(); + } if (verboseMode) { out.println("\n==> DEBUG: ----------------------------------- search finished"); out.println("\n==> DEBUG: State reduction mode : " + stateReductionMode); + out.println("\n==> DEBUG: Number of conflicts : " + numOfConflicts); out.println("\n==> DEBUG: Number of transitions : " + numOfTransitions); out.println("\n==> DEBUG: ----------------------------------- search finished" + "\n"); } @@ -212,6 +219,8 @@ public class DPORStateReducer extends ListenerAdapter { if (!isBooleanCGFlipped) { isBooleanCGFlipped = true; } else { + // Number of conflicts = first trace + subsequent backtrack points + numOfConflicts = 1 + doneBacktrackSet.size(); // Allocate new objects for data structure when the boolean is flipped from "false" to "true" initializeStatesVariables(); } -- 2.34.1