Skip to content
Snippets Groups Projects
Commit 50f1ac25 authored by Alex Reimers's avatar Alex Reimers
Browse files

Only measure the start and end time of an OFMessage if the processing time service is enabled.

parent 7f17d13a
No related branches found
No related tags found
No related merge requests found
......@@ -632,7 +632,11 @@ public class Controller
FloodlightContext bContext)
throws IOException {
Ethernet eth = null;
long startTime = System.nanoTime();
long startTime = 0;
if (pktinProcTime.isEnabled()) {
startTime = System.nanoTime();
}
switch (m.getType()) {
case PACKET_IN:
......@@ -700,11 +704,13 @@ public class Controller
}
if ((bContext == null) && (bc != null)) flcontext_free(bc);
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));
if (pktinProcTime.isEnabled()) {
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));
}
}
}
}
......
......@@ -6,6 +6,8 @@ import net.floodlightcontroller.perfmon.PerfMonConfigs;
public interface IPktInProcessingTimeService extends IFloodlightService {
public boolean isEnabled();
public CircularTimeBucketSet getCtbs();
public PerfMonConfigs getPerfMonCfgs();
......
......@@ -92,4 +92,9 @@ public class NullPktInProcessingTime
public void updateCumulativeTimeTotal(long onePktStartTime_ns) {
// no-op
}
@Override
public boolean isEnabled() {
return false;
}
}
......@@ -3,8 +3,6 @@ package net.floodlightcontroller.perfmon;
public class PerfMonConfigs {
/***
* procTimeMonitoringState: true if monitoring is on, default is false
* this variable is controller using a cli under the controller node
* (config-controller)> [no] performance-monitor processing-time
*/
protected boolean procTimeMonitoringState;
// overall per-component performance monitoring knob; off by default
......
......@@ -62,7 +62,10 @@ public class PktInProcessingTime
private int numComponents; // Numbert of components being monitored
private int numBuckets; // number of time buckets, each 10s long
@Override
public boolean isEnabled() {
return perfMonCfgs.isProcTimeMonitoringState();
}
public Long getLastPktTime_ns() {
return lastPktTime_ns;
......
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