Here is my stack trace and test class
java.lang.IllegalArgumentException: java_testSingleBlockRead[0] is declared with required signature[public void no-arguments]
at com.carrotsearch.junitbenchmarks.Result.getTestMethod(Result.java:101)
at com.carrotsearch.junitbenchmarks.db.DbConsumer.accept(DbConsumer.java:122)
at com.carrotsearch.junitbenchmarks.BenchmarkStatement.evaluate(BenchmarkStatement.java:349)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NoSuchMethodException: com.banana.memory.malloc.Benchmark.java_testSingleBlockRead[0]()
at java.lang.Class.getMethod(Class.java:1622)
at com.carrotsearch.junitbenchmarks.Result.getTestMethod(Result.java:99)
... 26 more
package com.banana.memory.malloc;
import static org.junit.Assert.assertEquals;
@RunWith(value = Parameterized.class)
public class Benchmark {
final int TOTAL_ALLOCATION_SIZE = 1 * 1024 * 1024;
int BLOCK_SIZE = 16;
final int NUM_BLOCKS = TOTAL_ALLOCATION_SIZE / BLOCK_SIZE;
int VAR_SIZE_ALLOCATION = -1;
IMemAllocator m_treeIntAllocator;
ChainedAllocator m_chainedIntAllocator;
@Rule
public TestRule benchmarkRun = new BenchmarkRule();
public Benchmark(int blockSize, int varSizeAllocationSize) {
BLOCK_SIZE = blockSize;
VAR_SIZE_ALLOCATION = varSizeAllocationSize;
}
@Parameters
public static Collection<Object[]> data() {
//@formatter:off
Object[][] data = new Object[][] {
{16, 256},
};
return Arrays.asList(data);
}
//@formatter:on
@Before
public void init() {
m_treeIntAllocator = new TreeAllocator(NUM_BLOCKS, BLOCK_SIZE);
m_treeIntAllocator.setDebug(true);
m_treeIntAllocator.setInitializer(new MemSetInitializer(-1));
m_chainedIntAllocator = new ChainedAllocator(NUM_BLOCKS, BLOCK_SIZE);
m_chainedIntAllocator.setDebug(true);
m_chainedIntAllocator.setInitializer(new MemSetInitializer(-1));
}
@After
public void cleanup() {
m_treeIntAllocator.clear();
m_chainedIntAllocator.clear();
}
@Test
public void java_testSingleBlockRead() {
@SuppressWarnings("unused")
long sum = 0;
for (int i = 0; i < NUM_BLOCKS; i++) {
int arr[] = new int[VAR_SIZE_ALLOCATION];
for (int j = 0; j < VAR_SIZE_ALLOCATION; j++) {
sum += arr[j];
}
arr = null; // "free"
}
}
@Test
public void java_testSingleBlockWrite() {
for (int i = 0; i < NUM_BLOCKS; i++) {
int arr[] = new int[VAR_SIZE_ALLOCATION];
for (int j = 0; j < VAR_SIZE_ALLOCATION; j++) {
arr[j] = j;
}
arr = null; // "free"
}
}
@Test
public void TreeIntAllocator_testSingleBlockRead() {
intAllocIntRead(m_treeIntAllocator);
}
@Test
public void ChainedIntAllocator_testSingleBlockRead() {
intAllocIntRead(m_chainedIntAllocator);
}
@Test
public void TreeIntAllocator_testSingleBlockWrite() {
intAllocIntWrite(m_treeIntAllocator);
}
@Test
public void ChainedIntAllocator_testSingleBlockWrite() {
intAllocIntWrite(m_chainedIntAllocator);
}
@Test
public void TreeIntAllocator_testSingleBlockArrayRead() {
intAllocArrayRead(m_treeIntAllocator);
}
@Test
public void ChainedIntAllocator_testSingleBlockArrayRead() {
intAllocArrayRead(m_chainedIntAllocator);
}
@Test
public void TreeIntAllocator_testSingleBlockArrayWrite() {
intAllocArrayWrite(m_treeIntAllocator);
}
@Test
public void ChainedIntAllocator_testSingleBlockArrayWrite() {
intAllocArrayWrite(m_chainedIntAllocator);
}
public void intAllocIntRead(IMemAllocator allocator) {
assertEquals(0, allocator.usedBlocks());
@SuppressWarnings("unused")
long sum = 0;
for (int i = 0; i < allocator.maxBlocks(); i++) {
int pointer = allocator.malloc(VAR_SIZE_ALLOCATION);
for (int j = 0; j < allocator.blockSize(); j++) {
sum += allocator.getInt(pointer, j);
}
allocator.free(pointer);
}
}
public void intAllocIntWrite(IMemAllocator allocator) {
assertEquals(0, allocator.usedBlocks());
@SuppressWarnings("unused")
long sum = 0;
for (int i = 0; i < allocator.maxBlocks(); i++) {
int pointer = allocator.malloc(VAR_SIZE_ALLOCATION);
for (int j = 0; j < allocator.blockSize(); j++) {
allocator.setInt(pointer, j, j);
}
allocator.free(pointer);
}
}
public void intAllocArrayRead(IMemAllocator allocator) {
assertEquals(0, allocator.usedBlocks());
int block[] = new int[VAR_SIZE_ALLOCATION];
for (int i = 0; i < allocator.maxBlocks(); i++) {
int pointer = allocator.malloc(VAR_SIZE_ALLOCATION);
for (int j = 0; j < allocator.blockSize(); j++) {
allocator.getInts(pointer, 0, block, 0, VAR_SIZE_ALLOCATION);
}
allocator.free(pointer);
}
}
public void intAllocArrayWrite(IMemAllocator allocator) {
assertEquals(0, allocator.usedBlocks());
int block[] = new int[VAR_SIZE_ALLOCATION];
for (int i = 0; i < allocator.maxBlocks(); i++) {
int pointer = allocator.malloc(VAR_SIZE_ALLOCATION);
for (int j = 0; j < allocator.blockSize(); j++) {
allocator.setInts(pointer, 0, block, 0, VAR_SIZE_ALLOCATION);
}
allocator.free(pointer);