Thomas Vachuska
Committed by Gerrit Code Review

Simplified onos-wipe-out shell tool

Added instrumentation to FlowObjectiveManager to confirm/deny time-cost of pipeliner setup.

Change-Id: I93bcd786b0a7cb2b953a23c51f82a20d915d8d1a
......@@ -282,9 +282,11 @@ public class FlowObjectiveManager implements FlowObjectiveService {
switch (event.type()) {
case MASTER_CHANGED:
log.debug("mastership changed on device {}", event.subject());
long start = startWatch();
if (deviceService.isAvailable(event.subject())) {
setupPipelineHandler(event.subject());
}
stopWatch(start);
break;
case BACKUPS_CHANGED:
break;
......@@ -303,10 +305,12 @@ public class FlowObjectiveManager implements FlowObjectiveService {
case DEVICE_AVAILABILITY_CHANGED:
log.debug("Device either added or availability changed {}",
event.subject().id());
long start = startWatch();
if (deviceService.isAvailable(event.subject().id())) {
log.debug("Device is now available {}", event.subject().id());
setupPipelineHandler(event.subject().id());
}
stopWatch(start);
break;
case DEVICE_UPDATED:
break;
......@@ -326,6 +330,24 @@ public class FlowObjectiveManager implements FlowObjectiveService {
}
}
// Temporary mechanism to monitor pipeliner setup time-cost; there are
// intermittent time where this takes in excess of 2 seconds. Why?
private long totals = 0, count = 0;
private static final long LIMIT = 1;
private long startWatch() {
return System.currentTimeMillis();
}
private void stopWatch(long start) {
long duration = System.currentTimeMillis() - start;
totals += duration;
count += 1;
if (duration > LIMIT) {
log.info("Pipeline setup took {} ms; avg {} ms", duration, totals / count);
}
}
// Processing context for initializing pipeline driver behaviours.
private class InnerPipelineContext implements PipelinerContext {
@Override
......
......@@ -3,9 +3,7 @@
# Wipes out all data from the ONOS cluster. Temporary until wipe-out is fixed.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
while ! onos-check-summary $OCI '.*' 0 0 0 0 0; do
onos $OCI wipe-out please
for node in ${ONOS_INSTANCES:-$OCI}; do
onos $node wipe-out please
done
onos-check-summary $OCI '.*' 0 0 0 0 0
......