mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2026-10-12 09:24:52 -05:00
fix jmh invocation
This commit is contained in:
1 parent
fa879079f8
commit
22124a22ef
2 files changed
+52
-39
No files matched your search
@@ -21,52 +21,25 @@ There is a JMH suite intended to quantify the steady-state overhead of the new s
|
||||
|
||||
## Running
|
||||
|
||||
The simplest way is to run the runner from your IDE after building the module:
|
||||
The simplest way is to run the JUnit microbench test so `mvn test` can select it:
|
||||
|
||||
- Runner: `io.nosqlbench.engine.api.activityapi.sysperf.engineflow.EngineFlowPerfBaseliner`
|
||||
- Optional arg0: a JMH include regex (defaults to `.*(engineflow\\..*Bench|StrideContextJmhBench).*`)
|
||||
- Optional arg1: a JMH results file (does not suppress console output)
|
||||
- Test: `io.nosqlbench.engine.api.activityapi.sysperf.engineflow.EngineFlowJmhTest`
|
||||
- Tags: `microbench`, `engine`
|
||||
- Default include regex: `.*(engineflow\\..*Bench|StrideContextJmhBench).*`
|
||||
|
||||
Offline build (no downloads) to compile the benchmarks:
|
||||
### Maven `test` examples
|
||||
|
||||
Run only the engine-flow JMH suite:
|
||||
|
||||
```bash
|
||||
mvn -o -pl nb-engine/nb-engine-core -am test -DskipTests
|
||||
mvn -pl nb-engine/nb-engine-core -Pmicrobench -Dtest=EngineFlowJmhTest test
|
||||
```
|
||||
|
||||
### Maven `exec:java` examples
|
||||
|
||||
In a multi-module reactor, `exec:java` runs once per module; use a build step + a single-module exec step (chained with `&&`) so the exec only happens for `nb-engine-core`:
|
||||
Run all microbench-tagged tests:
|
||||
|
||||
```bash
|
||||
mvn -pl nb-engine/nb-engine-core -am -DskipTests test-compile \
|
||||
&& mvn -pl nb-engine/nb-engine-core -DskipTests exec:java \
|
||||
-Dexec.mainClass=io.nosqlbench.engine.api.activityapi.sysperf.engineflow.EngineFlowPerfBaseliner
|
||||
mvn -pl nb-engine/nb-engine-core -Pmicrobench test
|
||||
```
|
||||
|
||||
Run the baseliner with an explicit include regex and a JMH results file:
|
||||
|
||||
```bash
|
||||
mvn -pl nb-engine/nb-engine-core -am -DskipTests test-compile \
|
||||
&& mvn -pl nb-engine/nb-engine-core -DskipTests exec:java \
|
||||
-Dexec.mainClass=io.nosqlbench.engine.api.activityapi.sysperf.engineflow.EngineFlowPerfBaseliner \
|
||||
-Dexec.args='\".*engineflow\\\\..*Bench.*\" /tmp/jmh_engineflow.json'
|
||||
```
|
||||
|
||||
List available benchmarks (JMH `-l`):
|
||||
|
||||
```bash
|
||||
mvn -pl nb-engine/nb-engine-core -am -DskipTests test-compile \
|
||||
&& mvn -pl nb-engine/nb-engine-core -DskipTests exec:java \
|
||||
-Dexec.mainClass=org.openjdk.jmh.Main -Dexec.args='-l'
|
||||
```
|
||||
|
||||
Run only the engine-flow benchmarks (JMH include regex):
|
||||
|
||||
```bash
|
||||
mvn -pl nb-engine/nb-engine-core -am -DskipTests test-compile \
|
||||
&& mvn -pl nb-engine/nb-engine-core -DskipTests exec:java \
|
||||
-Dexec.mainClass=org.openjdk.jmh.Main \
|
||||
-Dexec.args='-wi 2 -i 3 -f 1 \".*(engineflow\\\\..*Bench|StrideContextJmhBench).*\"'
|
||||
```
|
||||
|
||||
Offline variants: add `-o` to both Maven invocations (requires the needed plugin/deps to already be present in your local repo).
|
||||
You can also set `-Dnb.junit.tags=microbench` instead of `-Pmicrobench`.
|
||||
Offline variants: add `-o` (requires the needed plugin/deps to already be present in your local repo).
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2025 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.engine.api.activityapi.sysperf.engineflow;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
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;
|
||||
|
||||
@Tag("microbench")
|
||||
@Tag("engine")
|
||||
public class EngineFlowJmhTest {
|
||||
|
||||
@Test
|
||||
public void runEngineFlowBenchmarks() throws RunnerException {
|
||||
Options options = new OptionsBuilder()
|
||||
.include(".*(engineflow\\..*Bench|StrideContextJmhBench).*")
|
||||
.forks(1)
|
||||
.shouldFailOnError(true)
|
||||
.build();
|
||||
|
||||
new Runner(options).run();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user