Modified performance measurement way
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
index 56fcb91..19098b9 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -15,6 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.tinkerpop.blueprints.impls.ramcloud.PerfMon;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.pipes.PipeFunction;
import com.tinkerpop.pipes.transform.PathPipe;
@@ -27,6 +28,7 @@
protected final static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
protected DBOperation dbop;
+ private static PerfMon pm = PerfMon.getInstance();
/**
* Initialize the object. Open LinkStorage using given configuration file.
@@ -137,6 +139,7 @@
deleteDeviceOnPort(link.getDst(),link.getDstPort());
long startLinkTime = System.nanoTime();
+ pm.addlink_start();
if (addLinkImpl(link)) {
// Set LinkInfo only if linfo is non-null.
if (linfo != null && (! setLinkInfoImpl(link, linfo))) {
@@ -144,6 +147,7 @@
dbop.rollback();
}
dbop.commit();
+ pm.addlink_end();
long endLinkTime = System.nanoTime();
log.error("Performance ##add link total time {}", endLinkTime - startLinkTime);
success = true;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
index 7672e92..019637d 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;
+import com.tinkerpop.blueprints.impls.ramcloud.PerfMon;
+
import net.floodlightcontroller.core.IOFSwitch;
import net.onrc.onos.graph.DBOperation;
import net.onrc.onos.graph.GraphDBManager;
@@ -26,6 +28,9 @@
protected DBOperation op;
protected final static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
public final long measureONOSTimeProp = Long.valueOf(System.getProperty("benchmark.measureONOS", "0"));
+ public final long measureAllTimeProp = Long.valueOf(System.getProperty("benchmark.measureAll", "0"));
+
+ private static PerfMon pm = PerfMon.getInstance();
/***
* Initialize function. Before you use this class, please call this method
@@ -144,12 +149,20 @@
long startUpdSwitchTime = 0, endUpdSwitchTime=0;
long startPortTime = 0, endPortTime=0;
long totalStartTime =0, totalEndTime=0;
+ long Tstamp1=0;
try {
if (measureONOSTimeProp == 1) {
+ log.error("Performance: addSwitch dpid= {} Start", dpid);
totalStartTime = System.nanoTime();
}
+ pm.addswitch_start();
ISwitchObject curr = op.searchSwitch(dpid);
+ if (measureONOSTimeProp == 1) {
+ Tstamp1 = System.nanoTime();
+ log.error("Performance: addSwitch dpid= {} searchSwitch done at {} took {}", dpid, Tstamp1, Tstamp1-totalStartTime);
+ }
+
if (curr != null) {
//If existing the switch. set The SW state ACTIVE.
log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
@@ -165,19 +178,25 @@
startSwitchTime = System.nanoTime();
}
curr = addSwitchImpl(dpid);
+ pm.addswitch_end();
if (measureONOSTimeProp == 1) {
endSwitchTime = System.nanoTime();
+ //log.error("Performance: addSwitch dpid= {} addSwitchImpl done at {} took {}", dpid, endSwitchTime, endSwitchTime-startSwitchTime);
+ log.error("Performance: addSwitch dpid= {} End searchSwitch {} addSwitchImpl {} total {} diff {}", dpid, Tstamp1-totalStartTime, endSwitchTime-startSwitchTime, endSwitchTime-totalStartTime,endSwitchTime-totalStartTime-(Tstamp1-totalStartTime)-(endSwitchTime-startSwitchTime));
}
}
if (measureONOSTimeProp == 1) {
startPortTime = System.nanoTime();
}
long noOfPorts = 0;
+ pm.addport_start();
for (OFPhysicalPort port: sw.getPorts()) {
//addPort(dpid, port);
addPortImpl(curr, port);
noOfPorts++;
+ pm.addport_incr();
}
+ pm.addport_end();
if (measureONOSTimeProp == 1) {
endPortTime = System.nanoTime();
}
@@ -198,10 +217,11 @@
totalEndTime = System.nanoTime();
}
if (startSwitchTime != 0) {
- log.error("Performance -- switch add total time {}", endSwitchTime - startSwitchTime);
+ //log.error("Performance -- switch add total time {}", endSwitchTime - startSwitchTime);
+ log.error("Performance -- switch add total time {} including_search {}", endSwitchTime - startSwitchTime, endSwitchTime - totalStartTime);
}
if (startUpdSwitchTime != 0) {
- log.error("Performance -- switch update total time {}", endUpdSwitchTime - startUpdSwitchTime);
+ log.error("Performance -- switch update total time {} including_search {}", endUpdSwitchTime - startUpdSwitchTime, endUpdSwitchTime - totalStartTime);
}
if (startPortTime != 0) {
log.error("Performance @@ port add total time {} no of ports written {}", endPortTime - startPortTime, noOfPorts);