melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle
Apache License 2.0
669 stars 88 forks source link

Running individual tests and different JVM_ARGS #162

Open wind57 opened 4 years ago

wind57 commented 4 years ago

This is actually a question, not a bug itself.

1) Is there a way to run a single test class? For example if I have multiple file in src/jmh? It should be a trivial thing to have, but I might simply miss this setting.

2) It seems that I specify @Warmup(iterations = 2, time = 3) on the class level of my JMH test, this is totally ignored and still I see the iteration as 5. The bigger problem I have with this is that, the only way to do it would be via jmh {...}, but I very often run benchmarks with various settings per single file; i.e.:

@Fork(value = 1, jvmArgsAppend = "-XX:TieredStopAtLevel=1")
public boolean plainC1Only(){....}

and

@Fork(value = 1,
        jvmArgsAppend = {
            "-XX:+UnlockExperimentalVMOptions",
            "-XX:+EagerJVMCI",
            "-Dgraal.ShowConfiguration=info",
            "-XX:+UseJVMCICompiler",
            "-XX:+EnableJVMCI"
        })
 public boolean someOtherTest(

in the same class, to see the differences. It seems this is not possible?

Thank you, Eugene.

bric3 commented 2 years ago

@wind57

  1. Currently not possible : There's however a workaround, see https://github.com/melix/jmh-gradle-plugin/issues/152#issuecomment-936568604

  2. Could this be related to recompilation not being done, or that warmup is overridden elsewhere (i.e warmupIterations.set(3) or -wi 3), I didn't spot any issue with various combination for @Fork / @Warmup on class and/or methods.

@Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS)
# JMH version: 1.34
# VM version: JDK 18, OpenJDK 64-Bit Server VM, 18+37-FR
# VM invoker: /Users/brice.dutheil/.asdf/installs/java/corretto-18.0.0.37.1/bin/java
# VM options: -Xms512m -Xmx512m -Djmh.separateClasspathJAR=true --add-modules=jdk.incubator.foreign --enable-native-access=ALL-UNNAMED
# Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
# Warmup: 3 iterations, 500 ms each
# Measurement: 10 iterations, 500 ms each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: com.github.bric3.benchmark.CryptoBoxSealBenchmark.jna

# Run progress: 0.00% complete, ETA 00:02:42
# Fork: 1 of 5
...