Simplified onos-wipe-out shell tool
Added instrumentation to FlowObjectiveManager to confirm/deny time-cost of pipeliner setup.
Change-Id: I93bcd786b0a7cb2b953a23c51f82a20d915d8d1a
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
index 7cbc67f..61f3552 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
@@ -282,9 +282,11 @@
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 @@
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 @@
}
}
+ // 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
diff --git a/tools/test/bin/onos-wipe-out b/tools/test/bin/onos-wipe-out
index 4384fc2..6e99634 100755
--- a/tools/test/bin/onos-wipe-out
+++ b/tools/test/bin/onos-wipe-out
@@ -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