* Add performance monitoring points
* Move the code for sending notifications for deleted Flow Entries
  outside of a loop, so the corresponding performance measurements are
  more accurate.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
index 931bdd1..8806572 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -286,6 +286,8 @@
 
 	if (enableOnrc2014MeasurementsFlows) {
 
+	    PerformanceMonitor.start("EventHandler.ProcessAllEvents");
+
 	    if (topologyEvents.isEmpty() && flowIdEvents.isEmpty() &&
 		switchDpidEvents.isEmpty()) {
 		return;		// Nothing to do
@@ -300,9 +302,12 @@
 	    processFlowIdEvents(mySwitches);
 
 	    // Fetch the topology
+	    PerformanceMonitor.start("EventHandler.ReadTopology");
 	    processTopologyEvents();
+	    PerformanceMonitor.stop("EventHandler.ReadTopology");
 
 	    // Recompute all affected Flow Paths and keep only the modified
+	    PerformanceMonitor.start("EventHandler.RecomputeFlows");
 	    for (FlowPath flowPath : shouldRecomputeFlowPaths.values()) {
 		if (recomputeFlowPath(flowPath))
 		    modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
@@ -317,10 +322,12 @@
 		    }
 		}
 	    }
+	    PerformanceMonitor.stop("EventHandler.RecomputeFlows");
 
 	    //
 	    // Push the modified state to the database
 	    //
+	    PerformanceMonitor.start("EventHandler.WriteFlowsToDb");
 	    for (FlowPath flowPath : modifiedFlowPaths.values()) {
 		//
 		// Delete the Flow Path from the Network Map
@@ -331,10 +338,17 @@
 		    // TODO: For now the deleting of a Flow Path is blocking
 		    ParallelFlowDatabaseOperation.deleteFlow(dbHandler,
 							     flowPath.flowId());
+		    //
+		    // NOTE: For now the sending of the notifications
+		    // is outside of this loop, so the performance measurements
+		    // are more accurate.
+		    //
+		    /*
 		    // Send the notifications for the deleted Flow Entries
 		    for (FlowEntry flowEntry : flowPath.flowEntries()) {
 			datagridService.notificationSendFlowEntryRemoved(flowEntry.flowEntryId());
 		    }
+		    */
 
 		    continue;
 		}
@@ -346,6 +360,23 @@
 		ParallelFlowDatabaseOperation.addFlow(dbHandler, flowPath,
 						      datagridService);
 	    }
+	    PerformanceMonitor.stop("EventHandler.WriteFlowsToDb");
+
+	    //
+	    // Send the notifications for the deleted Flow Entries
+	    // NOTE: This code was pulled outside of the above loop,
+	    // so the performance measurements are more accurate.
+	    //
+	    PerformanceMonitor.start("EventHandler.NotificationSend.FlowEntryRemoved");
+	    for (FlowPath flowPath : modifiedFlowPaths.values()) {
+		if (flowPath.flowPathUserState() ==
+		    FlowPathUserState.FP_USER_DELETE) {
+		    for (FlowEntry flowEntry : flowPath.flowEntries()) {
+			datagridService.notificationSendFlowEntryRemoved(flowEntry.flowEntryId());
+		    }
+		}
+	    }
+	    PerformanceMonitor.stop("EventHandler.WriteFlowsToDb");
 
 	    // Cleanup
 	    topologyEvents.clear();
@@ -357,6 +388,9 @@
 	    shouldRecomputeFlowPaths.clear();
 	    modifiedFlowPaths.clear();
 
+	    PerformanceMonitor.stop("EventHandler.ProcessAllEvents");
+	    PerformanceMonitor.report();
+
 	    return;
 	}
 
@@ -1365,9 +1399,12 @@
     @Override
     public void notificationRecvFlowEntryAdded(FlowEntry flowEntry) {
 	if (enableOnrc2014MeasurementsFlows) {
+	    PerformanceMonitor.start("EventHandler.AddFlowEntryToSwitch");
 	    Collection entries = new ArrayList();
 	    entries.add(flowEntry);
 	    flowManager.pushModifiedFlowEntriesToSwitches(entries);
+	    PerformanceMonitor.stop("EventHandler.AddFlowEntryToSwitch");
+	    PerformanceMonitor.report();
 	    return;
 	}
 
@@ -1384,6 +1421,7 @@
     @Override
     public void notificationRecvFlowEntryRemoved(FlowEntry flowEntry) {
 	if (enableOnrc2014MeasurementsFlows) {
+	    PerformanceMonitor.start("EventHandler.RemoveFlowEntryFromSwitch");
 	    //
 	    // NOTE: Must update the state to DELETE, because
 	    // the notification contains the original state.
@@ -1393,6 +1431,8 @@
 	    Collection entries = new ArrayList();
 	    entries.add(flowEntry);
 	    flowManager.pushModifiedFlowEntriesToSwitches(entries);
+	    PerformanceMonitor.stop("EventHandler.RemoveFlowEntryFromSwitch");
+	    PerformanceMonitor.report();
 	    return;
 	}