Adding some instrumentation to figure out where transient delays in creating pipeliner come from.
Change-Id: I7ad08a660f2915f6df4ceeaa63f798eaca0720a8
Showing
1 changed file
with
6 additions
and
16 deletions
| ... | @@ -194,14 +194,12 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -194,14 +194,12 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 194 | @Override | 194 | @Override |
| 195 | public void filter(DeviceId deviceId, FilteringObjective filteringObjective) { | 195 | public void filter(DeviceId deviceId, FilteringObjective filteringObjective) { |
| 196 | checkPermission(Permission.FLOWRULE_WRITE); | 196 | checkPermission(Permission.FLOWRULE_WRITE); |
| 197 | - | ||
| 198 | executorService.submit(new ObjectiveInstaller(deviceId, filteringObjective)); | 197 | executorService.submit(new ObjectiveInstaller(deviceId, filteringObjective)); |
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | @Override | 200 | @Override |
| 202 | public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { | 201 | public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { |
| 203 | checkPermission(Permission.FLOWRULE_WRITE); | 202 | checkPermission(Permission.FLOWRULE_WRITE); |
| 204 | - | ||
| 205 | if (queueObjective(deviceId, forwardingObjective)) { | 203 | if (queueObjective(deviceId, forwardingObjective)) { |
| 206 | return; | 204 | return; |
| 207 | } | 205 | } |
| ... | @@ -211,14 +209,12 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -211,14 +209,12 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 211 | @Override | 209 | @Override |
| 212 | public void next(DeviceId deviceId, NextObjective nextObjective) { | 210 | public void next(DeviceId deviceId, NextObjective nextObjective) { |
| 213 | checkPermission(Permission.FLOWRULE_WRITE); | 211 | checkPermission(Permission.FLOWRULE_WRITE); |
| 214 | - | ||
| 215 | executorService.submit(new ObjectiveInstaller(deviceId, nextObjective)); | 212 | executorService.submit(new ObjectiveInstaller(deviceId, nextObjective)); |
| 216 | } | 213 | } |
| 217 | 214 | ||
| 218 | @Override | 215 | @Override |
| 219 | public int allocateNextId() { | 216 | public int allocateNextId() { |
| 220 | checkPermission(Permission.FLOWRULE_WRITE); | 217 | checkPermission(Permission.FLOWRULE_WRITE); |
| 221 | - | ||
| 222 | return flowObjectiveStore.allocateNextId(); | 218 | return flowObjectiveStore.allocateNextId(); |
| 223 | } | 219 | } |
| 224 | 220 | ||
| ... | @@ -238,8 +234,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -238,8 +234,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 238 | 234 | ||
| 239 | // Retrieves the device pipeline behaviour from the cache. | 235 | // Retrieves the device pipeline behaviour from the cache. |
| 240 | private Pipeliner getDevicePipeliner(DeviceId deviceId) { | 236 | private Pipeliner getDevicePipeliner(DeviceId deviceId) { |
| 241 | - Pipeliner pipeliner = pipeliners.get(deviceId); | 237 | + return pipeliners.get(deviceId); |
| 242 | - return pipeliner; | ||
| 243 | } | 238 | } |
| 244 | 239 | ||
| 245 | private void setupPipelineHandler(DeviceId deviceId) { | 240 | private void setupPipelineHandler(DeviceId deviceId) { |
| ... | @@ -254,7 +249,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -254,7 +249,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 254 | try { | 249 | try { |
| 255 | // Otherwise create it and if it has pipeline behaviour, cache it | 250 | // Otherwise create it and if it has pipeline behaviour, cache it |
| 256 | handler = driverService.createHandler(deviceId); | 251 | handler = driverService.createHandler(deviceId); |
| 257 | - bTime = now(); | ||
| 258 | if (!handler.driver().hasBehaviour(Pipeliner.class)) { | 252 | if (!handler.driver().hasBehaviour(Pipeliner.class)) { |
| 259 | log.warn("Pipeline behaviour not supported for device {}", | 253 | log.warn("Pipeline behaviour not supported for device {}", |
| 260 | deviceId); | 254 | deviceId); |
| ... | @@ -266,16 +260,15 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -266,16 +260,15 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 266 | } | 260 | } |
| 267 | 261 | ||
| 268 | driverHandlers.put(deviceId, handler); | 262 | driverHandlers.put(deviceId, handler); |
| 269 | - cTime = now(); | 263 | + hTime = now(); |
| 270 | } | 264 | } |
| 271 | 265 | ||
| 272 | // Always (re)initialize the pipeline behaviour | 266 | // Always (re)initialize the pipeline behaviour |
| 273 | log.info("Driver {} bound to device {} ... initializing driver", | 267 | log.info("Driver {} bound to device {} ... initializing driver", |
| 274 | handler.driver().name(), deviceId); | 268 | handler.driver().name(), deviceId); |
| 275 | Pipeliner pipeliner = handler.behaviour(Pipeliner.class); | 269 | Pipeliner pipeliner = handler.behaviour(Pipeliner.class); |
| 276 | - dTime = now(); | 270 | + hbTime = now(); |
| 277 | pipeliner.init(deviceId, context); | 271 | pipeliner.init(deviceId, context); |
| 278 | - eTime = now(); | ||
| 279 | pipeliners.putIfAbsent(deviceId, pipeliner); | 272 | pipeliners.putIfAbsent(deviceId, pipeliner); |
| 280 | } | 273 | } |
| 281 | 274 | ||
| ... | @@ -288,7 +281,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -288,7 +281,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 288 | log.debug("mastership changed on device {}", event.subject()); | 281 | log.debug("mastership changed on device {}", event.subject()); |
| 289 | start = now(); | 282 | start = now(); |
| 290 | if (deviceService.isAvailable(event.subject())) { | 283 | if (deviceService.isAvailable(event.subject())) { |
| 291 | - aTime = now(); | ||
| 292 | setupPipelineHandler(event.subject()); | 284 | setupPipelineHandler(event.subject()); |
| 293 | } | 285 | } |
| 294 | stopWatch(); | 286 | stopWatch(); |
| ... | @@ -312,7 +304,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -312,7 +304,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 312 | event.subject().id()); | 304 | event.subject().id()); |
| 313 | start = now(); | 305 | start = now(); |
| 314 | if (deviceService.isAvailable(event.subject().id())) { | 306 | if (deviceService.isAvailable(event.subject().id())) { |
| 315 | - aTime = now(); | ||
| 316 | log.debug("Device is now available {}", event.subject().id()); | 307 | log.debug("Device is now available {}", event.subject().id()); |
| 317 | setupPipelineHandler(event.subject().id()); | 308 | setupPipelineHandler(event.subject().id()); |
| 318 | } | 309 | } |
| ... | @@ -339,7 +330,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -339,7 +330,7 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 339 | // Temporary mechanism to monitor pipeliner setup time-cost; there are | 330 | // Temporary mechanism to monitor pipeliner setup time-cost; there are |
| 340 | // intermittent time where this takes in excess of 2 seconds. Why? | 331 | // intermittent time where this takes in excess of 2 seconds. Why? |
| 341 | private long start = 0, totals = 0, count = 0; | 332 | private long start = 0, totals = 0, count = 0; |
| 342 | - private long aTime, bTime, cTime, dTime, eTime; | 333 | + private long hTime, hbTime; |
| 343 | private static final long LIMIT = 500; | 334 | private static final long LIMIT = 500; |
| 344 | 335 | ||
| 345 | private long now() { | 336 | private long now() { |
| ... | @@ -351,9 +342,8 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -351,9 +342,8 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
| 351 | totals += duration; | 342 | totals += duration; |
| 352 | count += 1; | 343 | count += 1; |
| 353 | if (duration > LIMIT) { | 344 | if (duration > LIMIT) { |
| 354 | - log.info("Pipeline setup took {} ms; avg {} ms; a={}, b={}, c={}, d={}, e={}", | 345 | + log.info("Pipeline setup took {} ms; avg {} ms; hTime={}, hbTime={}", |
| 355 | - duration, totals / count, diff(aTime), diff(bTime), | 346 | + duration, totals / count, diff(hTime), diff(hbTime)); |
| 356 | - diff(cTime), diff(dTime), diff(eTime)); | ||
| 357 | } | 347 | } |
| 358 | } | 348 | } |
| 359 | 349 | ... | ... |
-
Please register or login to post a comment