-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced shared Benchmarks utility (#972)
- Loading branch information
Showing
3 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/java/com/pivovarit/collectors/benchmark/Benchmarks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.pivovarit.collectors.benchmark; | ||
|
||
import org.openjdk.jmh.results.format.ResultFormatType; | ||
import org.openjdk.jmh.runner.Runner; | ||
import org.openjdk.jmh.runner.RunnerException; | ||
import org.openjdk.jmh.runner.options.OptionsBuilder; | ||
|
||
import java.nio.file.Path; | ||
|
||
final class Benchmarks { | ||
|
||
private Benchmarks() { | ||
} | ||
|
||
private static final Path BENCHMARKS_PATH = Path.of("src/test/resources/benchmarks/"); | ||
|
||
static void run(Class<?> clazz) throws RunnerException { | ||
new Runner(new OptionsBuilder() | ||
.include(clazz.getSimpleName()) | ||
.warmupIterations(3) | ||
.measurementIterations(5) | ||
.resultFormat(ResultFormatType.JSON) | ||
.result(Benchmarks.BENCHMARKS_PATH.resolve("%s.json".formatted(clazz.getSimpleName())).toString()) | ||
.forks(1) | ||
.build()).run(); | ||
} | ||
} |
File renamed without changes.