-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMain.java
More file actions
42 lines (37 loc) · 1.85 KB
/
Main.java
File metadata and controls
42 lines (37 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.datadoghq.profiler.stresstest;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.CommandLineOptions;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
public class Main {
public static final String SCENARIOS_PACKAGE = "com.datadoghq.profiler.stresstest.scenarios.";
public static void main(String... args) throws Exception {
String filter = "*";
if (args.length == 1) {
filter = args[0];
} else if (args.length > 1) {
System.err.println("Usage: java -jar ddprof-stresstest.jar [scenario filter]");
System.exit(1);
}
CommandLineOptions commandLineOptions = new CommandLineOptions(args);
Mode mode = Mode.AverageTime;
Options options = new OptionsBuilder()
.parent(new CommandLineOptions(args))
.include(SCENARIOS_PACKAGE + filter)
.addProfiler(WhiteboxProfiler.class)
.forks(commandLineOptions.getForkCount().orElse(1))
.warmupIterations(commandLineOptions.getWarmupIterations().orElse(0))
.measurementIterations(commandLineOptions.getMeasurementIterations().orElse(1))
.measurementTime(commandLineOptions.getMeasurementTime().orElse(TimeValue.seconds(5)))
.timeUnit(commandLineOptions.getTimeUnit().orElse(TimeUnit.MICROSECONDS))
.mode(mode)
.build();
Collection<RunResult> results = new Runner(options).run();
CompositeFormatter.of(new HtmlCommentFormatter(results, mode), new HtmlFormatter(results, mode)).format();
}
}