1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-01 07:14:29 +00:00

[benchmarks] Add verbose flag to FfiStructCopy benchmark suite.

Change-Id: I28ab6c85db3705224a59f80ea3c13a78a141c851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318923
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
Tess Strickland 2023-08-08 11:59:29 +00:00 committed by Commit Queue
parent 06b2967188
commit 51ae7c7b9d

View File

@ -10,6 +10,7 @@
import 'dart:ffi';
import 'dart:math';
import 'package:args/args.dart';
import 'package:ffi/ffi.dart';
import 'benchmark_generated.dart';
@ -82,7 +83,11 @@ abstract class StructCopyBenchmark {
void run(int batchSize);
}
final argParser = ArgParser()
..addFlag('verbose', abbr: 'v', help: 'Verbose output', defaultsTo: false);
void main(List<String> args) {
final results = argParser.parse(args);
final benchmarks = [
Copy1Bytes.new,
Copy32Bytes.new,
@ -90,11 +95,11 @@ void main(List<String> args) {
Copy32768Bytes.new,
];
final filter = args.firstOrNull;
final filter = results.rest.firstOrNull;
for (var constructor in benchmarks) {
final benchmark = constructor();
if (filter == null || benchmark.name.contains(filter)) {
benchmark.report();
benchmark.report(verbose: results['verbose']);
}
}
}