|
27 | 27 | import java.util.Collection; |
28 | 28 | import java.util.List; |
29 | 29 | import java.util.stream.Collectors; |
| 30 | +import java.util.stream.Stream; |
30 | 31 | import org.apache.commons.cli.CommandLine; |
31 | 32 | import org.apache.commons.cli.CommandLineParser; |
32 | 33 | import org.apache.commons.cli.DefaultParser; |
@@ -119,7 +120,29 @@ private BenchmarkRunner(List<String> benchmarksToRun, BenchmarkRunnerOptions opt |
119 | 120 | this.options = options; |
120 | 121 | } |
121 | 122 |
|
| 123 | + static List<String> getShardClasses(String shard) { |
| 124 | + switch (shard) { |
| 125 | + case "sync": return SYNC_BENCHMARKS; |
| 126 | + case "async": return ASYNC_BENCHMARKS; |
| 127 | + case "protocol": return PROTOCOL_BENCHMARKS; |
| 128 | + case "coldStart": return COLD_START_BENCHMARKS; |
| 129 | + case "metrics": return Stream.concat(METRIC_BENCHMARKS.stream(), METRIC_PUBLISHER_BENCHMARKS.stream()) |
| 130 | + .collect(Collectors.toList()); |
| 131 | + case "all": return Stream.of(SYNC_BENCHMARKS, ASYNC_BENCHMARKS, PROTOCOL_BENCHMARKS, |
| 132 | + COLD_START_BENCHMARKS, METRIC_BENCHMARKS, METRIC_PUBLISHER_BENCHMARKS) |
| 133 | + .flatMap(List::stream).collect(Collectors.toList()); |
| 134 | + default: throw new IllegalArgumentException("Unknown shard: " + shard); |
| 135 | + } |
| 136 | + } |
| 137 | + |
122 | 138 | public static void main(String... args) throws Exception { |
| 139 | + if (args.length >= 2 && args[0].equals("--list")) { |
| 140 | + // CHECKSTYLE:OFF |
| 141 | + System.out.println(String.join("|", getShardClasses(args[1]))); |
| 142 | + // CHECKSTYLE:ON |
| 143 | + return; |
| 144 | + } |
| 145 | + |
123 | 146 | List<String> benchmarksToRun = new ArrayList<>(); |
124 | 147 | benchmarksToRun.addAll(SYNC_BENCHMARKS); |
125 | 148 | benchmarksToRun.addAll(ASYNC_BENCHMARKS); |
|
0 commit comments