Commit 62e92f98 authored by Jonathan Shahen's avatar Jonathan Shahen

Reducing Debugging statement impact on performance

parent 43e64ae5
......@@ -50,8 +50,10 @@ public class ConvertToASAPTimeSA extends ConvertTo {
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
/* Timing */timing.stopTimer(tPrefix + "_" + "removeEnableDisableRules");
logger.fine("[STEPWISE] Query Before roleHelper.alwaysOnRules Conversion: " + workableQuery);
logger.fine("[STEPWISE] Rules Before roleHelper.alwaysOnRules Conversion: " + workableRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("[STEPWISE] Query Before roleHelper.alwaysOnRules Conversion: " + workableQuery);
logger.fine("[STEPWISE] Rules Before roleHelper.alwaysOnRules Conversion: " + workableRules);
}
/* Timing */timing.startTimer(tPrefix + "_" + "alwaysOnRules");
workableRules = roleHelper.alwaysOnRules(workableRules, workableQuery, timeIntervalHelper);
......@@ -66,8 +68,10 @@ public class ConvertToASAPTimeSA extends ConvertTo {
/* Timing */timing.stopTimer(tPrefix + "_" + "reduceToTimeslots");
logger.fine("[STEPWISE] Query Before ASAPTimeSA_Query Conversion: " + workableQuery);
logger.fine("[STEPWISE] Rules Before toASAPTimeSA_Rules Conversion: " + workableRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("[STEPWISE] Query Before ASAPTimeSA_Query Conversion: " + workableQuery);
logger.fine("[STEPWISE] Rules Before toASAPTimeSA_Rules Conversion: " + workableRules);
}
// Convert Query to Reduced ASAPTime SA Query and add any extra rules as needed
ASAPTimeSA_Query query = toASAPTimeSA_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
......@@ -81,8 +85,10 @@ public class ConvertToASAPTimeSA extends ConvertTo {
// Stats and logging
numberOfRules = newRules.size();
logger.fine("Rules: " + m.getAllRules());
logger.fine("Reduced Rules: " + newRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Rules: " + m.getAllRules());
logger.fine("Reduced Rules: " + newRules);
}
// Generate the Converted String
/* Timing */timing.startTimer(tPrefix + "_" + "template");
......@@ -222,10 +228,12 @@ public class ConvertToASAPTimeSA extends ConvertTo {
precondition.add(id);
}
logger.fine("Timeslots: " + timeIntervalHelper._timeIntervals + "; Reduced Timeslots: "
+ timeIntervalHelper._reducedTimeIntervals);
logger.fine("Admin Interval: " + adminInterval + "Precondition: " + rule._preconditions + "; Role Schedule: "
+ roleSchedule + "; Target Role: " + rule._role);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Timeslots: " + timeIntervalHelper._timeIntervals + "; Reduced Timeslots: "
+ timeIntervalHelper._reducedTimeIntervals);
logger.fine("Admin Interval: " + adminInterval + "Precondition: " + rule._preconditions
+ "; Role Schedule: " + roleSchedule + "; Target Role: " + rule._role);
}
ASAPTimeSA_Rule rule_t;
for (Integer adminTimeslot : adminInterval) {
......@@ -242,7 +250,9 @@ public class ConvertToASAPTimeSA extends ConvertTo {
rule_t.precondition = precondition;
rule_t.roleTime = roleTimeslot;
logger.fine("Adding to rules: " + rule_t);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Adding to rules: " + rule_t);
}
rules.add(rule_t);
}
......
......@@ -6,6 +6,7 @@ import java.io.StringWriter;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.stringtemplate.v4.ST;
......@@ -67,22 +68,29 @@ public class ConvertToMohawk extends ConvertTo {
// (6)
/* Timing */timing.stopTimer(tPrefix + "_removeUninvokablePrecondtions");
logger.fine("[STEPWISE] Rules Before roleHelperTemporality.removePrecondtionsCanRevoke Conversion: "
+ workableRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("[STEPWISE] Rules Before roleHelperTemporality.removePrecondtionsCanRevoke Conversion: "
+ workableRules);
}
/* Timing */timing.startTimer(tPrefix + "_removePrecondtionsCanRevoke");
workableRules = roleHelper.removePrecondtionsCanRevoke(workableRules, false);
// (6)
/* Timing */timing.stopTimer(tPrefix + "_removePrecondtionsCanRevoke");
logger.fine("[STEPWISE] Rules Before roleHelperTemporality.removeTemporality Conversion: " + workableRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine(
"[STEPWISE] Rules Before roleHelperTemporality.removeTemporality Conversion: " + workableRules);
}
/* Timing */timing.startTimer(tPrefix + "_removeTemporality");
RoleHelper roleHelperTemporality = new RoleHelper(roleHelper);
ArrayList<Object> reducedRules = roleHelperTemporality.removeTemporality(workableRules, timeIntervalHelper);
/* Timing */timing.stopTimer(tPrefix + "_removeTemporality");
logger.fine("[STEPWISE] Rules Before CA and CR Conversion: " + workableRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("[STEPWISE] Rules Before CA and CR Conversion: " + workableRules);
}
// Convert Rules into Reduced Mohawk CA and CR Rules (5)
/* Timing */timing.startTimer(tPrefix + "_convertRules");
......
......@@ -10,6 +10,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.stringtemplate.v4.ST;
......@@ -68,8 +69,10 @@ public class ConvertToTRole extends ConvertTo {
// Stats and logging
numberOfRules = newRules.size();
logger.fine("Rules: " + m.getAllRules());
logger.fine("Reduced Rules: " + newRules);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Rules: " + m.getAllRules());
logger.fine("Reduced Rules: " + newRules);
}
// Generate the Converted String
/* Timing */timing.startTimer(tPrefix + "_" + "template");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment