changeset 244:0b45beda9932

Runners: clean up State handling in test results.
author shade
date Thu, 12 May 2016 20:33:26 +0300
parents 13d571fe4348
children 44ed77c659aa
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/State.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/collectors/TestResult.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ExceptionReportPrinter.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/HTMLReportPrinter.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java jcstress-core/src/main/java/org/openjdk/jcstress/util/HashMultiset.java jcstress-core/src/main/java/org/openjdk/jcstress/util/LongHashMultiset.java jcstress-core/src/main/java/org/openjdk/jcstress/util/Multiset.java jcstress-core/src/main/java/org/openjdk/jcstress/util/Multisets.java
diffstat 11 files changed, 108 insertions(+), 239 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/State.java	Thu May 12 19:41:37 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jcstress.infra;
-
-import java.io.Serializable;
-
-/**
- * State line.
- *
- * @author Aleksey Shipilev (aleksey.shipilev@oracle.com)
- */
-public class State implements Serializable {
-    private final Object result;
-    private final long count;
-
-    public State(Object result, long count) {
-        this.result = result;
-        this.count = count;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        State state = (State) o;
-
-        if (!result.equals(state.result)) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return result.hashCode();
-    }
-
-    public String getId() {
-        return String.valueOf(result);
-    }
-
-    public long getCount() {
-        return count;
-    }
-
-    public Object getKey() {
-        return result;
-    }
-}
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/collectors/TestResult.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/collectors/TestResult.java	Thu May 12 20:33:26 2016 +0300
@@ -24,16 +24,15 @@
  */
 package org.openjdk.jcstress.infra.collectors;
 
-import org.openjdk.jcstress.infra.State;
 import org.openjdk.jcstress.infra.Status;
 import org.openjdk.jcstress.util.Environment;
+import org.openjdk.jcstress.util.HashMultiset;
+import org.openjdk.jcstress.util.Multiset;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -45,7 +44,7 @@
 
     private final String vmID;
     private final String name;
-    private final Map<State, State> states;
+    private final Multiset<String> states;
     private volatile Environment env;
     private final Status status;
     private final List<String> auxData;
@@ -54,17 +53,12 @@
         this.vmID = VM_ID;
         this.name = name;
         this.status = status;
-        this.states = new HashMap<>();
+        this.states = new HashMultiset<>();
         this.auxData = new ArrayList<>();
     }
 
-    public void addState(Object result, long count) {
-        State ns = new State(result, count);
-        State os = states.get(ns);
-        if (os != null) {
-            ns = new State(result, count + os.getCount());
-        }
-        states.put(ns, ns);
+    public void addState(String result, long count) {
+        states.add(result, count);
     }
 
     public void addAuxData(String data) {
@@ -79,10 +73,6 @@
         return name;
     }
 
-    public Collection<State> getStates() {
-        return states.values();
-    }
-
     public Environment getEnv() {
         return env;
     }
@@ -98,4 +88,16 @@
     public List<String> getAuxData() {
         return auxData;
     }
+
+    public long getTotalCount() {
+        return states.size();
+    }
+
+    public long getCount(String s) {
+        return states.count(s);
+    }
+
+    public Collection<String> getStateKeys() {
+        return states.keys();
+    }
 }
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Thu May 12 20:33:26 2016 +0300
@@ -26,7 +26,6 @@
 
 import org.openjdk.jcstress.Options;
 import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.infra.State;
 import org.openjdk.jcstress.infra.StateCase;
 import org.openjdk.jcstress.infra.TestInfo;
 import org.openjdk.jcstress.infra.collectors.TestResult;
@@ -97,12 +96,7 @@
             firstTest = System.nanoTime();
         } else {
             observedResults.incrementAndGet();
-
-            int totalCount = 0;
-            for (State s : r.getStates()) {
-                totalCount += s.getCount();
-            }
-            observedCount.addAndGet(totalCount);
+            observedCount.addAndGet(r.getTotalCount());
         }
 
         printResult(r, verbose);
@@ -160,19 +154,19 @@
             int expectLen = "Expectation".length();
             int descLen = 60;
 
-            for (State s : r.getStates()) {
-                idLen = Math.max(idLen, s.getId().length());
-                occLen = Math.max(occLen, String.format("%,d", s.getCount()).length());
+            for (String s : r.getStateKeys()) {
+                idLen = Math.max(idLen, s.length());
+                occLen = Math.max(occLen, String.format("%,d", r.getCount(s)).length());
                 expectLen = Math.max(expectLen, Expect.UNKNOWN.toString().length());
             }
 
             TestInfo test = TestList.getInfo(r.getName());
             if (test == null) {
                 output.printf("%" + idLen + "s %" + occLen +"s %" + expectLen + "s  %-" + descLen + "s%n", "Observed state", "Occurrences", "Expectation", "Interpretation");
-                for (State s : r.getStates()) {
+                for (String s : r.getStateKeys()) {
                     output.printf("%" + idLen + "s %," + occLen + "d %" + expectLen + "s  %-" + descLen + "s%n",
-                            StringUtils.cutoff(s.getId(), idLen),
-                            s.getCount(),
+                            StringUtils.cutoff(s, idLen),
+                            r.getCount(s),
                             Expect.UNKNOWN,
                             "N/A");
                 }
@@ -191,18 +185,18 @@
 
             output.printf("%" + idLen + "s %" + occLen +"s %" + expectLen + "s  %-" + descLen + "s%n", "Observed state", "Occurrences", "Expectation", "Interpretation");
 
-            List<State> unmatchedStates = new ArrayList<>();
-            unmatchedStates.addAll(r.getStates());
+            List<String> unmatchedStates = new ArrayList<>();
+            unmatchedStates.addAll(r.getStateKeys());
 
             for (StateCase c : test.cases()) {
                 boolean matched = false;
 
-                for (State s : r.getStates()) {
-                    if (c.state().equals(s.getId())) {
+                for (String s : r.getStateKeys()) {
+                    if (c.state().equals(s)) {
                         // match!
                         output.printf("%" + idLen + "s %," + occLen + "d %" + expectLen + "s  %-" + descLen + "s%n",
-                                StringUtils.cutoff(s.getId(), idLen),
-                                s.getCount(),
+                                StringUtils.cutoff(s, idLen),
+                                r.getCount(s),
                                 c.expect(),
                                 StringUtils.cutoff(c.description(), descLen));
                         matched = true;
@@ -219,10 +213,10 @@
                 }
             }
 
-            for (State s : unmatchedStates) {
+            for (String s : unmatchedStates) {
                 output.printf("%" + idLen + "s %," + occLen + "d %" + expectLen + "s  %-" + descLen + "s%n",
-                        StringUtils.cutoff(s.getId(), idLen),
-                        s.getCount(),
+                        StringUtils.cutoff(s, idLen),
+                        r.getCount(s),
                         test.unmatched().expect(),
                         StringUtils.cutoff(test.unmatched().description(), descLen));
             }
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ExceptionReportPrinter.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ExceptionReportPrinter.java	Thu May 12 20:33:26 2016 +0300
@@ -26,16 +26,12 @@
 
 
 import org.openjdk.jcstress.Options;
-import org.openjdk.jcstress.infra.State;
 import org.openjdk.jcstress.infra.Status;
 import org.openjdk.jcstress.infra.TestInfo;
 import org.openjdk.jcstress.infra.collectors.InProcessCollector;
 import org.openjdk.jcstress.infra.collectors.TestResult;
 import org.openjdk.jcstress.infra.runners.TestList;
-import org.openjdk.jcstress.util.HashMultimap;
-import org.openjdk.jcstress.util.LongHashMultiset;
-import org.openjdk.jcstress.util.Multimap;
-import org.openjdk.jcstress.util.TreeMultimap;
+import org.openjdk.jcstress.util.*;
 
 import javax.xml.bind.JAXBException;
 import java.io.FileNotFoundException;
@@ -74,20 +70,20 @@
             for (String name : multiResults.keys()) {
                 Collection<TestResult> mergeable = multiResults.get(name);
 
-                LongHashMultiset<State> stateCounts = new LongHashMultiset<>();
+                Multiset<String> stateCounts = new HashMultiset<>();
 
                 Status status = Status.NORMAL;
                 for (TestResult r : mergeable) {
                     status = status.combine(r.status());
-                    for (State s : r.getStates()) {
-                        stateCounts.add(s, s.getCount());
+                    for (String s : r.getStateKeys()) {
+                        stateCounts.add(s, r.getCount(s));
                     }
                 }
 
                 TestResult root = new TestResult(name, status);
 
-                for (State s : stateCounts.keys()) {
-                    root.addState(s.getKey(), stateCounts.count(s));
+                for (String s : stateCounts.keys()) {
+                    root.addState(s, stateCounts.count(s));
                 }
 
                 results.put(name, root);
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/HTMLReportPrinter.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/HTMLReportPrinter.java	Thu May 12 20:33:26 2016 +0300
@@ -27,18 +27,13 @@
 
 import org.openjdk.jcstress.Options;
 import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.infra.State;
 import org.openjdk.jcstress.infra.StateCase;
 import org.openjdk.jcstress.infra.Status;
 import org.openjdk.jcstress.infra.TestInfo;
 import org.openjdk.jcstress.infra.collectors.InProcessCollector;
 import org.openjdk.jcstress.infra.collectors.TestResult;
 import org.openjdk.jcstress.infra.runners.TestList;
-import org.openjdk.jcstress.util.Environment;
-import org.openjdk.jcstress.util.HashMultimap;
-import org.openjdk.jcstress.util.LongHashMultiset;
-import org.openjdk.jcstress.util.Multimap;
-import org.openjdk.jcstress.util.TreeMultimap;
+import org.openjdk.jcstress.util.*;
 
 import javax.xml.bind.JAXBException;
 import java.awt.*;
@@ -87,7 +82,7 @@
             for (String name : multiResults.keys()) {
                 Collection<TestResult> mergeable = multiResults.get(name);
 
-                LongHashMultiset<State> stateCounts = new LongHashMultiset<>();
+                Multiset<String> stateCounts = new HashMultiset<>();
 
                 List<String> auxData = new ArrayList<>();
 
@@ -95,8 +90,8 @@
                 Environment env = null;
                 for (TestResult r : mergeable) {
                     status = status.combine(r.status());
-                    for (State s : r.getStates()) {
-                        stateCounts.add(s, s.getCount());
+                    for (String s : r.getStateKeys()) {
+                        stateCounts.add(s, r.getCount(s));
                     }
                     env = r.getEnv();
                     auxData.addAll(r.getAuxData());
@@ -104,8 +99,8 @@
 
                 TestResult root = new TestResult(name, status);
 
-                for (State s : stateCounts.keys()) {
-                    root.addState(s.getKey(), stateCounts.count(s));
+                for (String s : stateCounts.keys()) {
+                    root.addState(s, stateCounts.count(s));
                 }
 
                 root.setEnv(env);
@@ -528,11 +523,7 @@
     }
 
     public static String getRoughCount(TestResult r) {
-        long sum = 0;
-        for (State s : r.getStates()) {
-            sum += s.getCount();
-        }
-
+        long sum = r.getTotalCount();
         if (sum > 10) {
             return "10<sup>" + (int) Math.floor(Math.log10(sum)) + "</sup>";
         } else {
@@ -565,18 +556,18 @@
         output.println("<th>Interpretation</th>");
         output.println("</tr>");
 
-        List<State> unmatchedStates = new ArrayList<>();
-        unmatchedStates.addAll(r.getStates());
+        List<String> unmatchedStates = new ArrayList<>();
+        unmatchedStates.addAll(r.getStateKeys());
         for (StateCase c : test.cases()) {
 
             boolean matched = false;
 
-            for (State s : r.getStates()) {
-                if (c.state().equals(s.getId())) {
+            for (String s : r.getStateKeys()) {
+                if (c.state().equals(s)) {
                     // match!
-                    output.println("<tr bgColor=" + selectHTMLColor(c.expect(), s.getCount() == 0) + ">");
-                    output.println("<td>" + s.getId() + "</td>");
-                    output.println("<td align=center>" + s.getCount() + "</td>");
+                    output.println("<tr bgColor=" + selectHTMLColor(c.expect(), r.getCount(s) == 0) + ">");
+                    output.println("<td>" + s + "</td>");
+                    output.println("<td align=center>" + r.getCount(s) + "</td>");
                     output.println("<td align=center>" + c.expect() + "</td>");
                     output.println("<td>" + c.description() + "</td>");
                     output.println("</tr>");
@@ -595,10 +586,10 @@
             }
         }
 
-        for (State s : unmatchedStates) {
-            output.println("<tr bgColor=" + selectHTMLColor(test.unmatched().expect(), s.getCount() == 0) + ">");
-            output.println("<td>" + s.getId() + "</td>");
-            output.println("<td align=center>" + s.getCount() + "</td>");
+        for (String s : unmatchedStates) {
+            output.println("<tr bgColor=" + selectHTMLColor(test.unmatched().expect(), r.getCount(s) == 0) + ">");
+            output.println("<td>" + s + "</td>");
+            output.println("<td align=center>" + r.getCount(s) + "</td>");
             output.println("<td align=center>" + test.unmatched().expect() + "</td>");
             output.println("<td>" + test.unmatched().expect() + "</td>");
             output.println("</tr>");
@@ -631,10 +622,10 @@
         output.println("<th width=50>Refs</th>");
         output.println("</tr>");
 
-        for (State s : r.getStates()) {
-            output.println("<tr bgColor=" + selectHTMLColor(Expect.UNKNOWN, s.getCount() == 0) + ">");
-            output.println("<td>" + s.getId() + "</td>");
-            output.println("<td align=center>" + s.getCount() + "</td>");
+        for (String s : r.getStateKeys()) {
+            output.println("<tr bgColor=" + selectHTMLColor(Expect.UNKNOWN, r.getCount(s) == 0) + ">");
+            output.println("<td>" + s + "</td>");
+            output.println("<td align=center>" + r.getCount(s) + "</td>");
             output.println("<td align=center>" + Expect.UNKNOWN + "</td>");
             output.println("<td>" + "Unknows state" + "</td>");
             output.println("</tr>");
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/TestGrading.java	Thu May 12 20:33:26 2016 +0300
@@ -25,7 +25,6 @@
 package org.openjdk.jcstress.infra.grading;
 
 import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.infra.State;
 import org.openjdk.jcstress.infra.StateCase;
 import org.openjdk.jcstress.infra.TestInfo;
 import org.openjdk.jcstress.infra.collectors.TestResult;
@@ -58,35 +57,39 @@
         hasInteresting = false;
         hasSpec = false;
 
-        List<State> unmatchedStates = new ArrayList<>();
-        unmatchedStates.addAll(r.getStates());
+        List<String> unmatchedStates = new ArrayList<>();
+        unmatchedStates.addAll(r.getStateKeys());
         for (StateCase c : test.cases()) {
             boolean matched = false;
 
-            for (State s : r.getStates()) {
-                if (c.state().equals(s.getId())) {
-                    isPassed &= passed(c.expect(), s.getCount());
-                    hasInteresting |= hasInteresting(c.expect(), s.getCount());
-                    hasSpec |= hasSpec(c.expect(), s.getCount());
-                    failureMessages.add(failureMessage(s.getId(), c.expect(), s.getCount()));
+            Expect ex = c.expect();
+            for (String s : r.getStateKeys()) {
+                if (c.state().equals(s)) {
+                    long count = r.getCount(s);
+                    isPassed &= passed(ex, count);
+                    hasInteresting |= hasInteresting(ex, count);
+                    hasSpec |= hasSpec(ex, count);
+                    failureMessages.add(failureMessage(s, ex, count));
                     matched = true;
                     unmatchedStates.remove(s);
                 }
             }
 
             if (!matched) {
-                isPassed &= passed(c.expect(), 0);
-                hasInteresting |= hasInteresting(c.expect(), 0);
-                hasSpec |= hasSpec(c.expect(), 0);
-                failureMessages.add(failureMessage("N/A", c.expect(), 0));
+                isPassed &= passed(ex, 0);
+                hasInteresting |= hasInteresting(ex, 0);
+                hasSpec |= hasSpec(ex, 0);
+                failureMessages.add(failureMessage("N/A", ex, 0));
             }
         }
 
-        for (State s : unmatchedStates) {
-            isPassed &= passed(test.unmatched().expect(), s.getCount());
-            hasInteresting |= hasInteresting(test.unmatched().expect(), s.getCount());
-            hasSpec |= hasSpec(test.unmatched().expect(), s.getCount());
-            failureMessages.add(failureMessage(s.getId(), test.unmatched().expect(), s.getCount()));
+        for (String s : unmatchedStates) {
+            Expect expect = test.unmatched().expect();
+            long count = r.getCount(s);
+            isPassed &= passed(expect, count);
+            hasInteresting |= hasInteresting(expect, count);
+            hasSpec |= hasSpec(expect, count);
+            failureMessages.add(failureMessage(s, expect, count));
         }
     }
 
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Thu May 12 20:33:26 2016 +0300
@@ -122,7 +122,7 @@
         TestResult result = new TestResult(testName, Status.NORMAL);
 
         for (R e : results.elementSet()) {
-            result.addState(e, results.count(e));
+            result.addState(String.valueOf(e), results.count(e));
         }
 
         collector.add(result);
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/util/HashMultiset.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/util/HashMultiset.java	Thu May 12 20:33:26 2016 +0300
@@ -56,8 +56,8 @@
 
 public class HashMultiset<T> implements Multiset<T>, Serializable {
 
-    private final Map<T, Integer> map;
-    private int size;
+    private final Map<T, Long> map;
+    private long size;
 
     public HashMultiset() {
         map = new HashMap<>();
@@ -65,18 +65,23 @@
 
     @Override
     public void add(T element) {
-        Integer count = map.get(element);
+        add(element, 1);
+    }
+
+    @Override
+    public void add(T element, long add) {
+        Long count = map.get(element);
         if (count == null) {
-            count = 0;
+            count = 0L;
         }
-        count++;
-        size++;
+        count += add;
+        size += add;
         map.put(element, count);
     }
 
     @Override
-    public int count(T element) {
-        Integer count = map.get(element);
+    public long count(T element) {
+        Long count = map.get(element);
         return (count == null) ? 0 : count;
     }
 
@@ -86,7 +91,7 @@
     }
 
     @Override
-    public int size() {
+    public long size() {
         return size;
     }
 
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/util/LongHashMultiset.java	Thu May 12 19:41:37 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jcstress.util;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class LongHashMultiset<T> {
-
-    private Map<T, Holder> ms = new HashMap<>();
-
-    public void add(T t, long count) {
-        Holder holder = ms.get(t);
-        if (holder == null) {
-            holder = new Holder();
-            ms.put(t, holder);
-        }
-        holder.value += count;
-    }
-
-    public Set<T> keys() {
-        return ms.keySet();
-    }
-
-    public long count(T t) {
-        Holder holder = ms.get(t);
-        return (holder != null) ? holder.value : 0;
-    }
-
-    private static class Holder {
-        public long value;
-    }
-
-}
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/util/Multiset.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/util/Multiset.java	Thu May 12 20:33:26 2016 +0300
@@ -66,11 +66,18 @@
     void add(T element);
 
     /**
+     * Add the element to the multiset, specified number of times
+     * @param element element to add
+     * @param count count
+     */
+    void add(T element, long count);
+
+    /**
      * Count the elements in multiset
      * @param element element
      * @return number of matching elements in the set; zero, if no elements
      */
-    int count(T element);
+    long count(T element);
 
     /**
      * Answers if Multiset is empty
@@ -84,7 +91,7 @@
      *
      * @return number of elements
      */
-    int size();
+    long size();
 
     /**
      * Answers the collection of keys
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/util/Multisets.java	Thu May 12 19:41:37 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/util/Multisets.java	Thu May 12 20:33:26 2016 +0300
@@ -50,7 +50,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Comparator;
 import java.util.List;
 import java.util.PriorityQueue;
 
@@ -58,7 +57,7 @@
 
     public static <T> Collection<T> countHighest(Multiset<T> set, int top) {
         // crude and inefficient
-        PriorityQueue<Pair<T, Integer>> q = new PriorityQueue<>(10, (o1, o2) -> o2.k2.compareTo(o1.k2));
+        PriorityQueue<Pair<T, Long>> q = new PriorityQueue<>(10, (o1, o2) -> o2.k2.compareTo(o1.k2));
 
         for (T key : set.keys()) {
             q.add(new Pair<>(key, set.count(key)));