Skip to content

Commit 8e8b673

Browse files
davidh44joviegas
authored andcommitted
BenchmarkRunner get shard classes (#6966)
* Add method to return shard classes from BenchmarkRunner * Add method to return shard classes from BenchmarkRunner
1 parent 36acb46 commit 8e8b673

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/sdk-benchmarks/src/main/java/software/amazon/awssdk/benchmark/BenchmarkRunner.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Collection;
2828
import java.util.List;
2929
import java.util.stream.Collectors;
30+
import java.util.stream.Stream;
3031
import org.apache.commons.cli.CommandLine;
3132
import org.apache.commons.cli.CommandLineParser;
3233
import org.apache.commons.cli.DefaultParser;
@@ -119,7 +120,29 @@ private BenchmarkRunner(List<String> benchmarksToRun, BenchmarkRunnerOptions opt
119120
this.options = options;
120121
}
121122

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+
122138
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+
123146
List<String> benchmarksToRun = new ArrayList<>();
124147
benchmarksToRun.addAll(SYNC_BENCHMARKS);
125148
benchmarksToRun.addAll(ASYNC_BENCHMARKS);

0 commit comments

Comments
 (0)