Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package com.elastic;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
public class PartialEATest {
@Param(value = {"1"})
private int value;
public void allocate(Blackhole bh) {
checkArg(value > 0, "expected non-negative value: %s, %s", value, 1000, "A", 700);
public static void checkArg(boolean cond, String msg, Object ... args){
if (!cond){
String format = String.format(msg, args);
throw new IllegalArgumentException(format);
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
new Runner(opt).run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment