jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1528089 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java
Date Tue, 01 Oct 2013 13:43:25 GMT
Author: thomasm
Date: Tue Oct  1 13:43:25 2013
New Revision: 1528089

URL: http://svn.apache.org/r1528089
Log:
OAK-641: Improved benchmark tooling - TimingDocumentWrappers: bugfix

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java?rev=1528089&r1=1528088&r2=1528089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/util/TimingDocumentStoreWrapper.java
Tue Oct  1 13:43:25 2013
@@ -21,6 +21,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.annotation.CheckForNull;
@@ -49,7 +50,7 @@ public class TimingDocumentStoreWrapper 
     private final Map<String, Count> counts = new HashMap<String, Count>();
     private long lastLogTime;
     private long totalLogTime;
-    private final HashMap<String, Integer> commonCalls = new HashMap<String, Integer>();
+    private final Map<String, Integer> slowCalls = new ConcurrentHashMap<String,
Integer>();
     
     private int callCount;
 
@@ -285,12 +286,12 @@ public class TimingDocumentStoreWrapper 
         }
     }
     
-    private synchronized void logCommonCall(long start, String key) {
+    private void logCommonCall(long start, String key) {
         int time = (int) (System.currentTimeMillis() - start);
         if (time <= 0) {
             return;
         }
-        HashMap<String, Integer> map = commonCalls;
+        Map<String, Integer> map = slowCalls;
         Integer oldCount = map.get(key);
         if (oldCount == null) {
             map.put(key, time);
@@ -385,7 +386,7 @@ public class TimingDocumentStoreWrapper 
             log("all count " + totalCount + " time " + totalTime + " " + 
                     (100 * totalTime / totalLogTime) + "%");
 
-            HashMap<String, Integer> map = commonCalls;
+            Map<String, Integer> map = slowCalls;
             int top = 10;
             int max = Integer.MAX_VALUE;
             for (int i = 0; i < top;) {
@@ -397,16 +398,19 @@ public class TimingDocumentStoreWrapper 
                 }
                 for (Entry<String, Integer> e : map.entrySet()) {
                     if (e.getValue() >= best && e.getValue() < max) {
-                        log("common call " + e.getValue() + " " + e.getKey());
+                        log("slow call " + e.getValue() + " millis: " + e.getKey());
                         i++;
                         if (i >= top) {
                             break;
                         }
                     }
                 }
+                if (i >= map.size()) {
+                    break;
+                }
                 max = best;
             }
-            commonCalls.clear();
+            slowCalls.clear();
             
             log("------");
             



Mime
View raw message