Permalink
Browse files

Updates to print messages to log.info when packet-in processing time …

…exceeds 0.5s.
  • Loading branch information...
1 parent e7ed19d commit 179a71a4374c831b43690c1c5135e03f8d049aa3 @sriniram sriniram committed Dec 23, 2011
@@ -563,7 +563,7 @@ protected void sendPacket(HashSet<String> matchedFilters, IOFSwitch sw,
return sb.toString().getBytes();
}
- private String getStringFromEthernetPacket(Ethernet eth) {
+ public String getStringFromEthernetPacket(Ethernet eth) {
StringBuffer sb = new StringBuffer("\n");
@@ -723,6 +723,8 @@ protected void handleMessage(IOFSwitch sw, OFMessage m,
throws IOException {
Ethernet eth = null;
+ long startTime = System.nanoTime();
+
switch (m.getType()) {
case PACKET_IN:
OFPacketIn pi = (OFPacketIn)m;
@@ -785,8 +787,16 @@ protected void handleMessage(IOFSwitch sw, OFMessage m,
} else {
log.error("Unhandled OF Message: {} from {}", m, sw);
}
- break;
+
+ long processingTime = System.nanoTime() - startTime;
+ if (processingTime > (long)500000000) { // processing takes more than half a second
+ log.info("--**--**-- Time to process packet-in: {} ns", processingTime);
+ if (eth!= null)
+ log.info("{}", messageFilterManager.getStringFromEthernetPacket(eth));
+ log.info("--**--**-- ");
+ }
}
+
}
/**

0 comments on commit 179a71a

Please sign in to comment.