Skip to content
Snippets Groups Projects
Commit de5be349 authored by Rob Adams's avatar Rob Adams
Browse files

Additional work on debug counters

parent 56b16e27
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,7 @@ import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.debugcounter.IDebugCounterService;
import net.floodlightcontroller.debugcounter.IDebugCounterService.CounterType;
import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
......@@ -142,8 +143,9 @@ public class SyncManager extends AbstractSyncManager {
private static final String PACKAGE =
ISyncService.class.getPackage().getName();
public static final String COUNTER_HINTS = PACKAGE + "-hints";
public static final String COUNTER_SENT_VALUES = PACKAGE + "-sent-values";
public static final String COUNTER_RECEIVED_VALUES = PACKAGE + "-received-values";
public static final String COUNTER_SENT_VALUES = PACKAGE + "-sent_values";
public static final String COUNTER_RECEIVED_VALUES =
PACKAGE + "-received_values";
public static final String COUNTER_PUTS = PACKAGE + "-puts";
public static final String COUNTER_GETS = PACKAGE + "-gets";
public static final String COUNTER_ITERATORS = PACKAGE + "-iterators";
......@@ -535,6 +537,25 @@ public class SyncManager extends AbstractSyncManager {
@Override
public void startUp(FloodlightModuleContext context)
throws FloodlightModuleException {
debugCounter.registerCounter(COUNTER_HINTS,
"Queued sync events processed",
CounterType.ALWAYS_COUNT);
debugCounter.registerCounter(COUNTER_SENT_VALUES,
"Values synced to remote node",
CounterType.ALWAYS_COUNT);
debugCounter.registerCounter(COUNTER_RECEIVED_VALUES,
"Values received from remote node",
CounterType.ALWAYS_COUNT);
debugCounter.registerCounter(COUNTER_PUTS,
"Local puts to store",
CounterType.ALWAYS_COUNT);
debugCounter.registerCounter(COUNTER_GETS,
"Local gets from store",
CounterType.ALWAYS_COUNT);
debugCounter.registerCounter(COUNTER_ITERATORS,
"Local iterators created over store",
CounterType.ALWAYS_COUNT);
updateConfiguration();
rpcService = new RPCService(this, debugCounter);
rpcService.run();
......@@ -722,7 +743,11 @@ public class SyncManager extends AbstractSyncManager {
Iterable<Node> nodes = getClusterConfig().getNodes();
short localDomainId =
getClusterConfig().getNode().getDomainId();
short localNodeId =
getClusterConfig().getNode().getNodeId();
for (Node n : nodes) {
if (localNodeId == n.getNodeId())
continue;
for (SyncMessage bsm : messages.values()) {
SyncValueMessage svm = bsm.getSyncValue();
if (svm.getStore().getScope().
......@@ -736,7 +761,9 @@ public class SyncManager extends AbstractSyncManager {
svm.getHeader().
setTransactionId(rpcService.
getTransactionId());
debugCounter.updateCounter(COUNTER_SENT_VALUES);
debugCounter.updateCounter(COUNTER_SENT_VALUES,
bsm.getSyncValue().
getValuesSize());
rpcService.writeToNode(n.getNodeId(), bsm);
}
}
......
......@@ -18,6 +18,7 @@ import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.debugcounter.IDebugCounterService;
/**
* A floodlight module that will start up and start doing horrible,
......@@ -29,6 +30,8 @@ public class SyncTorture implements IFloodlightModule {
LoggerFactory.getLogger(SyncTorture.class);
ISyncService syncService;
IDebugCounterService debugCounter;
int numWorkers = 2;
int keysPerWorker = 1024*1024;
int iterations = 0;
......@@ -52,6 +55,8 @@ public class SyncTorture implements IFloodlightModule {
Collection<Class<? extends IFloodlightService>> l =
new ArrayList<Class<? extends IFloodlightService>>();
l.add(ISyncService.class);
l.add(IDebugCounterService.class);
return l;
}
......@@ -59,6 +64,8 @@ public class SyncTorture implements IFloodlightModule {
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
syncService = context.getServiceImpl(ISyncService.class);
debugCounter = context.getServiceImpl(IDebugCounterService.class);
try {
syncService.registerStore("torture", Scope.GLOBAL);
} catch (SyncException e) {
......@@ -174,6 +181,7 @@ public class SyncTorture implements IFloodlightModule {
logger.error("Error in worker: ", e);
}
long iterend = System.currentTimeMillis();
debugCounter.flushCounters();
logger.info("Completed iteration of {} values in {}ms" +
" ({}/s)",
new Object[]{values.size(), (iterend-start),
......
......@@ -268,7 +268,8 @@ public class RPCChannelHandler extends AbstractRPCChannelHandler {
new SyncMessage(MessageType.SYNC_VALUE_RESPONSE);
bsm.setSyncValueResponse(m);
updateCounter(SyncManager.COUNTER_RECEIVED_VALUES);
updateCounter(SyncManager.COUNTER_RECEIVED_VALUES,
request.getValuesSize());
channel.write(bsm);
} catch (Exception e) {
......@@ -350,7 +351,8 @@ public class RPCChannelHandler extends AbstractRPCChannelHandler {
}
if (svm.isSetValues()) {
updateCounter(SyncManager.COUNTER_SENT_VALUES);
updateCounter(SyncManager.COUNTER_SENT_VALUES,
svm.getValuesSize());
rpcService.syncQueue.add(new NodeMessage(getRemoteNodeId(),
bsm));
}
......@@ -473,8 +475,8 @@ public class RPCChannelHandler extends AbstractRPCChannelHandler {
// Utility functions
// *****************
protected void updateCounter(String counter) {
rpcService.debugCounter.updateCounter(counter);
protected void updateCounter(String counter, int incr) {
rpcService.debugCounter.updateCounter(counter, incr);
}
protected void startAntientropy() {
......
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