Skip to content
Snippets Groups Projects
Commit e9b5dc2c authored by abat's avatar abat
Browse files

Merge into master from pull request #3677:

parents 8f3d31d6 b2a199c5
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,11 @@ import net.floodlightcontroller.counter.CounterStore;
import net.floodlightcontroller.counter.ICounter;
import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.counter.SimpleCounter;
import net.floodlightcontroller.debugcounter.IDebugCounter;
import net.floodlightcontroller.debugcounter.IDebugCounterService;
import net.floodlightcontroller.debugcounter.NullDebugCounter;
import net.floodlightcontroller.debugcounter.IDebugCounterService.CounterException;
import net.floodlightcontroller.debugcounter.IDebugCounterService.CounterType;
import net.floodlightcontroller.flowcache.IFlowReconcileListener;
import net.floodlightcontroller.flowcache.OFMatchReconcile;
import net.floodlightcontroller.flowcache.PriorityPendingQueue.EventPriority;
......@@ -55,7 +60,7 @@ public class FlowReconcileManager
/** Reference to dependent modules */
protected IThreadPoolService threadPool;
protected ICounterStoreService counterStore;
protected IDebugCounterService debugCounters;
/**
* The list of flow reconcile listeners that have registered to get
* flow reconcile callbacks. Such callbacks are invoked, for example, when
......@@ -85,6 +90,13 @@ public class FlowReconcileManager
/** Config to enable or disable flowReconcile */
protected static final String EnableConfigKey = "enable";
/*
* Debug Counters
*/
public static final String PACKAGE = FlowReconcileManager.class.getPackage().getName();
private IDebugCounter ctrFlowReconcileRequest;
private IDebugCounter ctrReconciledFlows;
protected boolean flowReconcileEnabled;
public AtomicInteger flowReconcileThreadRunCount;
......@@ -130,6 +142,7 @@ public class FlowReconcileManager
OFMatchReconcile myOfmRc = new OFMatchReconcile(ofmRcIn);
flowQueue.offer(myOfmRc, priority);
ctrFlowReconcileRequest.updateCounterWithFlush();
Date currTime = new Date();
long delay = 0;
......@@ -187,7 +200,7 @@ public class FlowReconcileManager
throws FloodlightModuleException {
threadPool = context.getServiceImpl(IThreadPoolService.class);
counterStore = context.getServiceImpl(ICounterStoreService.class);
debugCounters = context.getServiceImpl(IDebugCounterService.class);
flowQueue = new PriorityPendingQueue<OFMatchReconcile>();
flowReconcileListeners =
new ListenerDispatcher<OFType, IFlowReconcileListener>();
......@@ -200,12 +213,30 @@ public class FlowReconcileManager
enableValue.equalsIgnoreCase("false")) {
flowReconcileEnabled = false;
}
registerFlowReconcileManagerDebugCounters();
flowReconcileThreadRunCount = new AtomicInteger(0);
lastReconcileTime = new Date(0);
logger.debug("FlowReconcile is {}", flowReconcileEnabled);
}
private void registerFlowReconcileManagerDebugCounters() throws FloodlightModuleException {
if (debugCounters == null) {
logger.error("Debug Counter Service not found.");
debugCounters = new NullDebugCounter();
}
try {
ctrFlowReconcileRequest = debugCounters.registerCounter(PACKAGE, "flow-reconcile-request",
"All flow reconcile request received by this module",
CounterType.ALWAYS_COUNT);
ctrReconciledFlows = debugCounters.registerCounter(PACKAGE, "reconciled-flows",
"All flows reconciled successfully by this module",
CounterType.ALWAYS_COUNT);
} catch (CounterException e) {
throw new FloodlightModuleException(e.getMessage());
}
}
@Override
public void startUp(FloodlightModuleContext context) {
// thread to do flow reconcile
......@@ -264,6 +295,7 @@ public class FlowReconcileManager
reconcileCapacity--;
if (ofmRc != null) {
ofmRcList.add(ofmRc);
ctrReconciledFlows.updateCounterWithFlush();
if (logger.isTraceEnabled()) {
logger.trace("Add flow {} to be the reconcileList", ofmRc.cookie);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment