MCPcopy Create free account
hub / github.com/LFYSec/MScan / BenchmarkRunner

Class BenchmarkRunner

src/test/java/pascal/taie/analysis/pta/BenchmarkRunner.java:36–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34import java.util.stream.Collectors;
35
36@CommandLine.Command
37public class BenchmarkRunner {
38
39 private static final String BENCHMARK_HOME = "java-benchmarks";
40
41 private static final String BENCHMARK_INFO = "java-benchmarks/benchmark-info.yml";
42
43 private static final Map<String, BenchmarkInfo> benchmarkInfos =
44 BenchmarkInfo.load(BENCHMARK_INFO);
45
46 @CommandLine.Option(names = "-cs", defaultValue = "ci")
47 private String cs;
48
49 @CommandLine.Option(names = "-java", defaultValue = "0")
50 private int jdk;
51
52 @CommandLine.Option(names = "-advanced", defaultValue = "null")
53 private String advanced;
54
55 @CommandLine.Parameters
56 private List<String> benchmarks;
57
58 public static void main(String[] args) {
59 BenchmarkRunner runner = CommandLine.populateCommand(new BenchmarkRunner(), args);
60 runner.runAll();
61 }
62
63 private void runAll() {
64 if (benchmarks == null) {
65 throw new IllegalArgumentException("benchmarks are not given");
66 }
67 benchmarks.forEach(this::run);
68 }
69
70 private void run(String benchmark) {
71 System.out.println("\nAnalyzing " + benchmark);
72 Main.main(composeArgs(benchmark));
73 }
74
75 private String[] composeArgs(String benchmark) {
76 BenchmarkInfo info = benchmarkInfos.get(benchmark);
77 List<String> args = new ArrayList<>();
78 int jdkVersion = jdk != 0 ? jdk : info.jdk();
79 Collections.addAll(args,
80 "-java", Integer.toString(jdkVersion),
81 "-acp", buildClassPath(info.apps()),
82 "-cp", buildClassPath(info.libs()),
83 "-wc",
84 "-m", info.main());
85 if (info.allowPhantom()) {
86 args.add("--allow-phantom");
87 }
88 Map<String, String> ptaArgs = Map.of(
89 "distinguish-string-constants", "null",
90 "merge-string-objects", "false",
91 "cs", cs,
92 "advanced", advanced,
93 "reflection-inference", "null",

Callers

nothing calls this directly

Calls 1

loadMethod · 0.95

Tested by

no test coverage detected