Skip to content
Snippets Groups Projects
Commit 8f9fea7a authored by Srinivasan Ramasubramanian's avatar Srinivasan Ramasubramanian
Browse files

Print warning messages when packet-in processing time exceeds a certain threshold.

parent b5d9e820
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,7 @@ public class Controller
protected OFMessageFilterManager messageFilterManager;
protected PktinProcessingTime pktinProcTime;
private StaticFlowEntryPusher staticFlowEntryPusher;
protected long ptWarningThresholdInNano;
protected List<RestletRoutable> restlets;
......@@ -735,6 +736,8 @@ public class Controller
FloodlightContext bContext)
throws IOException {
Ethernet eth = null;
long startTime = System.nanoTime();
switch (m.getType()) {
case PACKET_IN:
......@@ -808,6 +811,13 @@ public class Controller
} else {
log.error("Unhandled OF Message: {} from {}", m, sw);
}
long processingTime = System.nanoTime() - startTime;
if (ptWarningThresholdInNano > 0 && processingTime > ptWarningThresholdInNano) {
log.warn("Time to process packet-in: {} us", processingTime/1000.0);
if (eth != null)
log.warn("{}", messageFilterManager.getDataAsString(sw, m, bContext));
}
}
}
......@@ -1431,6 +1441,13 @@ public class Controller
restlets.add(new StorageWebRoutable());
restlets.add(new TopologyWebRouteable());
JacksonCustomConverter.replaceConverter();
// Processing Time Warning Threshold
ptWarningThresholdInNano = Long.parseLong(System.getProperty("net.floodlightcontroller.core.PTWarningThresholdInMilli", "0")) * 1000000;
if (ptWarningThresholdInNano > 0) {
log.info("Packet processing time threshold for warning set to {} ms.",
ptWarningThresholdInNano/1000000);
}
}
protected void initStorageSource() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment