Adding some instrumentation to figure out where transient delays in creating pipeliner come from.
Change-Id: I7ad08a660f2915f6df4ceeaa63f798eaca0720a8
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 b612b9e..9e9e63c 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
@@ -194,14 +194,12 @@
@Override
public void filter(DeviceId deviceId, FilteringObjective filteringObjective) {
checkPermission(Permission.FLOWRULE_WRITE);
-
executorService.submit(new ObjectiveInstaller(deviceId, filteringObjective));
}
@Override
public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) {
checkPermission(Permission.FLOWRULE_WRITE);
-
if (queueObjective(deviceId, forwardingObjective)) {
return;
}
@@ -211,14 +209,12 @@
@Override
public void next(DeviceId deviceId, NextObjective nextObjective) {
checkPermission(Permission.FLOWRULE_WRITE);
-
executorService.submit(new ObjectiveInstaller(deviceId, nextObjective));
}
@Override
public int allocateNextId() {
checkPermission(Permission.FLOWRULE_WRITE);
-
return flowObjectiveStore.allocateNextId();
}
@@ -238,8 +234,7 @@
// Retrieves the device pipeline behaviour from the cache.
private Pipeliner getDevicePipeliner(DeviceId deviceId) {
- Pipeliner pipeliner = pipeliners.get(deviceId);
- return pipeliner;
+ return pipeliners.get(deviceId);
}
private void setupPipelineHandler(DeviceId deviceId) {
@@ -254,7 +249,6 @@
try {
// Otherwise create it and if it has pipeline behaviour, cache it
handler = driverService.createHandler(deviceId);
- bTime = now();
if (!handler.driver().hasBehaviour(Pipeliner.class)) {
log.warn("Pipeline behaviour not supported for device {}",
deviceId);
@@ -266,16 +260,15 @@
}
driverHandlers.put(deviceId, handler);
- cTime = now();
+ hTime = now();
}
// Always (re)initialize the pipeline behaviour
log.info("Driver {} bound to device {} ... initializing driver",
handler.driver().name(), deviceId);
Pipeliner pipeliner = handler.behaviour(Pipeliner.class);
- dTime = now();
+ hbTime = now();
pipeliner.init(deviceId, context);
- eTime = now();
pipeliners.putIfAbsent(deviceId, pipeliner);
}
@@ -288,7 +281,6 @@
log.debug("mastership changed on device {}", event.subject());
start = now();
if (deviceService.isAvailable(event.subject())) {
- aTime = now();
setupPipelineHandler(event.subject());
}
stopWatch();
@@ -312,7 +304,6 @@
event.subject().id());
start = now();
if (deviceService.isAvailable(event.subject().id())) {
- aTime = now();
log.debug("Device is now available {}", event.subject().id());
setupPipelineHandler(event.subject().id());
}
@@ -339,7 +330,7 @@
// Temporary mechanism to monitor pipeliner setup time-cost; there are
// intermittent time where this takes in excess of 2 seconds. Why?
private long start = 0, totals = 0, count = 0;
- private long aTime, bTime, cTime, dTime, eTime;
+ private long hTime, hbTime;
private static final long LIMIT = 500;
private long now() {
@@ -351,9 +342,8 @@
totals += duration;
count += 1;
if (duration > LIMIT) {
- log.info("Pipeline setup took {} ms; avg {} ms; a={}, b={}, c={}, d={}, e={}",
- duration, totals / count, diff(aTime), diff(bTime),
- diff(cTime), diff(dTime), diff(eTime));
+ log.info("Pipeline setup took {} ms; avg {} ms; hTime={}, hbTime={}",
+ duration, totals / count, diff(hTime), diff(hbTime));
}
}