DanGuge commented on code in PR #2262:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2262#discussion_r1291011776


##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java:
##########
@@ -186,8 +185,56 @@ public static boolean checkAndParseAction(String action) {
         } else if (action.equals(ACTION_ELIMINATE)) {
             return false;
         } else {
-            throw new NotSupportedException(
-                      String.format("Not support action '%s'", action));
+            throw new NotSupportedException(String.format("Not support action 
'%s'", action));
+        }
+    }
+
+    public static class ApiMeasurer {
+
+        public static final String EDGE_ITER = "edge_iterations";
+        public static final String VERTICE_ITER = "vertice_iterations";
+        public static final String COST = "cost";
+        private final long timeStart;
+        private final Map<String, Object> measures;
+
+        public ApiMeasurer() {
+            this.timeStart = System.currentTimeMillis();
+            this.measures = InsertionOrderUtil.newMap();
+        }
+
+        public Map<String, Object> measures() {
+            measures.put(COST, System.currentTimeMillis() - timeStart);
+            return measures;
+        }
+
+        public void put(String key, String value) {
+            this.measures.put(key, value);
+        }
+
+        public void put(String key, long value) {
+            this.measures.put(key, value);
+        }
+
+        public void put(String key, int value) {
+            this.measures.put(key, value);
+        }
+
+        protected void addCount(String key, long value) {
+            Object current = measures.get(key);
+            if (current == null) {
+                measures.put(key, new MutableLong(value));
+            } else if (current instanceof MutableLong) {
+                MutableLong currentMutableLong = (MutableLong) current;
+                currentMutableLong.add(value);
+            } else if (current instanceof Long) {

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to