Thomas Vachuska

Hunting down elusive source of lag.

Change-Id: I9380bc5238202aeac7cbf89c32121b088451e02d
...@@ -245,10 +245,13 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -245,10 +245,13 @@ public class FlowObjectiveManager implements FlowObjectiveService {
245 245
246 // Attempt to lookup the handler in the cache 246 // Attempt to lookup the handler in the cache
247 DriverHandler handler = driverHandlers.get(deviceId); 247 DriverHandler handler = driverHandlers.get(deviceId);
248 + cTime = now();
249 +
248 if (handler == null) { 250 if (handler == null) {
249 try { 251 try {
250 // Otherwise create it and if it has pipeline behaviour, cache it 252 // Otherwise create it and if it has pipeline behaviour, cache it
251 handler = driverService.createHandler(deviceId); 253 handler = driverService.createHandler(deviceId);
254 + dTime = now();
252 if (!handler.driver().hasBehaviour(Pipeliner.class)) { 255 if (!handler.driver().hasBehaviour(Pipeliner.class)) {
253 log.warn("Pipeline behaviour not supported for device {}", 256 log.warn("Pipeline behaviour not supported for device {}",
254 deviceId); 257 deviceId);
...@@ -260,6 +263,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -260,6 +263,7 @@ public class FlowObjectiveManager implements FlowObjectiveService {
260 } 263 }
261 264
262 driverHandlers.put(deviceId, handler); 265 driverHandlers.put(deviceId, handler);
266 + eTime = now();
263 } 267 }
264 268
265 // Always (re)initialize the pipeline behaviour 269 // Always (re)initialize the pipeline behaviour
...@@ -330,7 +334,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -330,7 +334,7 @@ public class FlowObjectiveManager implements FlowObjectiveService {
330 // Temporary mechanism to monitor pipeliner setup time-cost; there are 334 // Temporary mechanism to monitor pipeliner setup time-cost; there are
331 // intermittent time where this takes in excess of 2 seconds. Why? 335 // intermittent time where this takes in excess of 2 seconds. Why?
332 private long start = 0, totals = 0, count = 0; 336 private long start = 0, totals = 0, count = 0;
333 - private long hTime, hbTime; 337 + private long cTime, dTime, eTime, hTime, hbTime;
334 private static final long LIMIT = 500; 338 private static final long LIMIT = 500;
335 339
336 private long now() { 340 private long now() {
...@@ -342,13 +346,14 @@ public class FlowObjectiveManager implements FlowObjectiveService { ...@@ -342,13 +346,14 @@ public class FlowObjectiveManager implements FlowObjectiveService {
342 totals += duration; 346 totals += duration;
343 count += 1; 347 count += 1;
344 if (duration > LIMIT) { 348 if (duration > LIMIT) {
345 - log.info("Pipeline setup took {} ms; avg {} ms; hTime={}, hbTime={}", 349 + log.info("Pipeline setup took {} ms; avg {} ms; cTime={}, dTime={}, eTime={}, hTime={}, hbTime={}",
346 - duration, totals / count, diff(hTime), diff(hbTime)); 350 + duration, totals / count, diff(cTime), diff(dTime), diff(eTime), diff(hTime), diff(hbTime));
347 } 351 }
348 } 352 }
349 353
350 private long diff(long bTime) { 354 private long diff(long bTime) {
351 - return bTime - start; 355 + long diff = bTime - start;
356 + return diff < 0 ? 0 : diff;
352 } 357 }
353 358
354 // Processing context for initializing pipeline driver behaviours. 359 // Processing context for initializing pipeline driver behaviours.
......