public void doRun() { GammaTxnLong ref = new GammaTxnLong(stm); // FatArrayTreeGammaTxn tx = new FatArrayTreeGammaTxn(stm); // FatArrayGammaTxn tx = new FatArrayGammaTxn(stm,1); FatMonoGammaTxn tx = new FatMonoGammaTxn( new GammaTxnConfig(stm) .setReadLockMode(LockMode.Exclusive) .setDirtyCheckEnabled(false)); long startMs = System.currentTimeMillis(); for (long k = 0; k < transactionCount; k++) { ref.openForWrite(tx, LOCKMODE_EXCLUSIVE).long_value++; tx.commit(); tx.hardReset(); // if (k % 100000000 == 0 && k > 0) { // System.out.printf("%s is at %s\n", getName(), k); // } } assertEquals(transactionCount, ref.atomicGet()); durationMs = System.currentTimeMillis() - startMs; System.out.printf("Multiverse> %s is finished in %s ms\n", getName(), durationMs); }
public void start(long transactionCount) { int[] processors = generateProcessorRange(); System.out.printf("Multiverse> Uncontended update lean-transaction benchmark\n"); System.out.printf("Multiverse> 1 GammaTxnRef per transaction\n"); System.out.printf("Multiverse> %s Transactions per thread\n", format(transactionCount)); System.out.printf( "Multiverse> Running with the following processor range %s\n", Arrays.toString(processors)); Result[] result = new Result[processors.length]; System.out.println("Multiverse> Starting warmup run"); test(1, transactionCount); System.out.println("Multiverse> Finished warmup run"); long startNs = System.nanoTime(); for (int k = 0; k < processors.length; k++) { int processorCount = processors[k]; double performance = test(processorCount, transactionCount); result[k] = new Result(processorCount, performance); } long durationNs = System.nanoTime() - startNs; System.out.printf( "Multiverse> Benchmark took %s seconds\n", TimeUnit.NANOSECONDS.toSeconds(durationNs)); toGnuplot(result); }