Add statistics to Map-Register cache
[lispflowmapping.git] / mappingservice / southbound / src / main / java / org / opendaylight / lispflowmapping / southbound / LispSouthboundStats.java
index 3ab543da9e65629e97f0886bf50271ed78bce176..76f194d633bdd07baa4875db59b5f3f2ba01b3d7 100644 (file)
@@ -22,6 +22,8 @@ public class LispSouthboundStats {
     private long tx[] = new long[MAX_LISP_TYPES + 1];
     private long rxUnknown = 0;
     private long txErrors = 0;
+    private long cacheHits = 0;
+    private long cacheMisses = 0;
 
     public LispSouthboundStats() {
         resetStats();
@@ -66,6 +68,22 @@ public class LispSouthboundStats {
         this.txErrors = incrementWithWrap(txErrors);
     }
 
+    public long getCacheHits() {
+        return cacheHits;
+    }
+
+    public void incrementCacheHits() {
+        this.cacheHits = incrementWithWrap(cacheHits);
+    }
+
+    public long getCacheMisses() {
+        return cacheMisses;
+    }
+
+    public void incrementCacheMisses() {
+        this.cacheMisses = incrementWithWrap(cacheMisses);
+    }
+
     private static long incrementWithWrap(long value) {
         if (value == Long.MAX_VALUE) {
             return 0;