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 { ...@@ -282,9 +282,11 @@ public class FlowObjectiveManager implements FlowObjectiveService {
282 switch (event.type()) { 282 switch (event.type()) {
283 case MASTER_CHANGED: 283 case MASTER_CHANGED:
284 log.debug("mastership changed on device {}", event.subject()); 284 log.debug("mastership changed on device {}", event.subject());
285 + long start = startWatch();
285 if (deviceService.isAvailable(event.subject())) { 286 if (deviceService.isAvailable(event.subject())) {
286 setupPipelineHandler(event.subject()); 287 setupPipelineHandler(event.subject());
287 } 288 }
289 + stopWatch(start);
288 break; 290 break;
289 case BACKUPS_CHANGED: 291 case BACKUPS_CHANGED:
290 break; 292 break;
...@@ -303,10 +305,12 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -303,10 +305,12 @@ public class FlowObjectiveManager implements FlowObjectiveService {
303 case DEVICE_AVAILABILITY_CHANGED: 305 case DEVICE_AVAILABILITY_CHANGED:
304 log.debug("Device either added or availability changed {}", 306 log.debug("Device either added or availability changed {}",
305 event.subject().id()); 307 event.subject().id());
308 + long start = startWatch();
306 if (deviceService.isAvailable(event.subject().id())) { 309 if (deviceService.isAvailable(event.subject().id())) {
307 log.debug("Device is now available {}", event.subject().id()); 310 log.debug("Device is now available {}", event.subject().id());
308 setupPipelineHandler(event.subject().id()); 311 setupPipelineHandler(event.subject().id());
309 } 312 }
313 + stopWatch(start);
310 break; 314 break;
311 case DEVICE_UPDATED: 315 case DEVICE_UPDATED:
312 break; 316 break;
...@@ -326,6 +330,24 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -326,6 +330,24 @@ public class FlowObjectiveManager implements FlowObjectiveService {
326 } 330 }
327 } 331 }
328 332
333 + // Temporary mechanism to monitor pipeliner setup time-cost; there are
334 + // intermittent time where this takes in excess of 2 seconds. Why?
335 + private long totals = 0, count = 0;
336 + private static final long LIMIT = 1;
337 +
338 + private long startWatch() {
339 + return System.currentTimeMillis();
340 + }
341 +
342 + private void stopWatch(long start) {
343 + long duration = System.currentTimeMillis() - start;
344 + totals += duration;
345 + count += 1;
346 + if (duration > LIMIT) {
347 + log.info("Pipeline setup took {} ms; avg {} ms", duration, totals / count);
348 + }
349 + }
350 +
329 // Processing context for initializing pipeline driver behaviours. 351 // Processing context for initializing pipeline driver behaviours.
330 private class InnerPipelineContext implements PipelinerContext { 352 private class InnerPipelineContext implements PipelinerContext {
331 @Override 353 @Override
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
3 # Wipes out all data from the ONOS cluster. Temporary until wipe-out is fixed. 3 # Wipes out all data from the ONOS cluster. Temporary until wipe-out is fixed.
4 # ----------------------------------------------------------------------------- 4 # -----------------------------------------------------------------------------
5 5
6 -[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 +for node in ${ONOS_INSTANCES:-$OCI}; do
7 -. $ONOS_ROOT/tools/build/envDefaults 7 + onos $node wipe-out please
8 -
9 -while ! onos-check-summary $OCI '.*' 0 0 0 0 0; do
10 - onos $OCI wipe-out please
11 done 8 done
9 +onos-check-summary $OCI '.*' 0 0 0 0 0
......