use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project druid by druid-io.
the class BitmapCreationBenchmark method testToImmutableByteArray.
@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
@Test
public void testToImmutableByteArray() {
ImmutableBitmap immutableBitmap = factory.makeImmutableBitmap(baseMutableBitmap);
Assert.assertArrayEquals(baseBytes, immutableBitmap.toBytes());
}
use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project druid by druid-io.
the class BenchmarkIndexibleWrites method testConcurrentWrites.
@BenchmarkOptions(warmupRounds = 100, benchmarkRounds = 100, clock = Clock.REAL_TIME, callgc = true)
@Ignore
@Test
public /**
* CALLEN - 2015-01-15 - OSX - Java 1.7.0_71-b14
* BenchmarkIndexibleWrites.testConcurrentWrites[0]: [measured 100 out of 200 rounds, threads: 1 (sequential)]
* round: 0.24 [+- 0.01], round.block: 0.00 [+- 0.00], round.gc: 0.02 [+- 0.00], GC.calls: 396, GC.time: 1.88, time.total: 50.60, time.warmup: 24.84, time.bench: 25.77
* BenchmarkIndexibleWrites.testConcurrentWrites[1]: [measured 100 out of 200 rounds, threads: 1 (sequential)]
* round: 0.15 [+- 0.01], round.block: 0.00 [+- 0.00], round.gc: 0.02 [+- 0.00], GC.calls: 396, GC.time: 2.11, time.total: 33.14, time.warmup: 16.09, time.bench: 17.05
*/
void testConcurrentWrites() throws ExecutionException, InterruptedException {
final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(concurrentThreads, new ThreadFactoryBuilder().setDaemon(false).setNameFormat("indexible-writes-benchmark-%d").build()));
final AtomicInteger index = new AtomicInteger(0);
List<ListenableFuture<?>> futures = new ArrayList<>();
final Integer loops = totalIndexSize / concurrentThreads;
for (int i = 0; i < concurrentThreads; ++i) {
futures.add(executorService.submit(new Runnable() {
@Override
public void run() {
for (int i = 0; i < loops; ++i) {
final Integer idx = index.getAndIncrement();
concurrentIndexible.set(idx, idx);
}
}
}));
}
Futures.allAsList(futures).get();
Assert.assertTrue(StringUtils.format("Index too small %d, expected %d across %d loops", index.get(), totalIndexSize, loops), index.get() >= totalIndexSize);
for (int i = 0; i < index.get(); ++i) {
Assert.assertEquals(i, concurrentIndexible.get(i).intValue());
}
concurrentIndexible.clear();
futures.clear();
executorService.shutdown();
}
use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project druid by druid-io.
the class CostBalancerStrategyBenchmark method testBenchmark.
@Test
@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
public void testBenchmark() {
DataSegment segment = CostBalancerStrategyTest.getSegment(1000, "testds", interval1);
selected = strategy.findNewSegmentHomeReplicator(segment, serverHolderList);
}
use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project DirectMemory by raffaeleguidi.
the class ConcurrentTests2 method retrieveCatchHalfOfThem.
@BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds = 0, concurrency = 100)
@Test
public void retrieveCatchHalfOfThem() {
String key = "test-" + (rndGen.nextInt(entries * 2) + 1);
Pointer p = map.get(key);
read.incrementAndGet();
if (p != null) {
got.incrementAndGet();
byte[] payload = MemoryManager.retrieve(p);
if (key.equals(new String(payload)))
good.incrementAndGet();
else
bad.incrementAndGet();
} else {
missed.incrementAndGet();
}
}
use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project DirectMemory by raffaeleguidi.
the class ConcurrentTests2 method retrieveCatchThemAll.
@BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds = 0, concurrency = 100)
@Test
public void retrieveCatchThemAll() {
String key = "test-" + (rndGen.nextInt(entries) + 1);
Pointer p = map.get(key);
read.incrementAndGet();
if (p != null) {
got.incrementAndGet();
byte[] payload = MemoryManager.retrieve(p);
if (key.equals(new String(payload)))
good.incrementAndGet();
else
bad.incrementAndGet();
} else {
logger.info("did not find key " + key);
missed.incrementAndGet();
}
}
Aggregations