2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package dstm2.benchmark;
8 import TransactionalIO.benchmarks.benchmark;
9 import TransactionalIO.core.TransactionalFile;
10 import TransactionalIO.exceptions.GracefulException;
12 import dstm2.benchmark.Counter.CountKeeper;
13 import dstm2.factory.Factory;
15 import dstm2.util.Random;
16 import java.util.Vector;
17 import java.util.concurrent.Callable;
18 import java.util.concurrent.locks.ReentrantLock;
24 public abstract class CustomBenchmark{
26 public ReentrantLock programlock = new ReentrantLock();
28 public static final Object lock = new Object();
39 * Number of calls to insert()
43 * number of calls to contains()
45 int containsCalls = 0;
47 * number of calls to remove()
51 * amount by which the set size has changed
55 protected abstract void init();
57 protected abstract void execute(Vector arguments);
59 protected abstract void printResults();
61 public CustomBenchmark() {
64 // public static Vector hotwords;
69 * Prints an error message to <code>System.out</code>, including a
70 * standard header to identify the message as an error message.
71 * @param s String describing error
73 protected static void reportError(String s) {
74 System.out.println(" ERROR: " + s);
78 public void report() {
79 System.out.println("Insert/Remove calls:\t" + (insertCalls + removeCalls));
80 System.out.println("Contains calls:\t" + containsCalls);
86 public void sanityCheck() {
87 long expected = delta;
90 int prevValue = Integer.MIN_VALUE;
91 /* for (int value : this) {
93 if (value < prevValue) {
94 System.out.println("ERROR: set not sorted");
97 if (value == prevValue) {
98 System.out.println("ERROR: set has duplicates!");
101 if (length == expected) {
102 System.out.println("ERROR: set has bad length!");
107 System.out.println("Integer Set OK");