Add --benchType and --sourceType to nanobench.
To run only codec benches:
$ out/Release/nanobench --images <> --benchType skcodec
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1666743002
Review URL: https://codereview.chromium.org/1666743002
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index c2bcb49..7b37562 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -112,6 +112,11 @@
DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json");
DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out");
+DEFINE_string(sourceType, "",
+ "Apply usual --match rules to source type: bench, gm, skp, image, etc.");
+DEFINE_string(benchType, "",
+ "Apply usual --match rules to bench type: micro, recording, playback, skcodec, etc.");
+
static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
static SkString humanize(double ms) {
@@ -628,6 +633,18 @@
}
Benchmark* next() {
+ SkAutoTDelete<Benchmark> bench;
+ do {
+ bench.reset(this->rawNext());
+ if (!bench) {
+ return nullptr;
+ }
+ } while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) ||
+ SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType));
+ return bench.detach();
+ }
+
+ Benchmark* rawNext() {
if (fBenches) {
Benchmark* bench = fBenches->factory()(nullptr);
fBenches = fBenches->next();