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
This commit is contained in:
mtklein 2016-02-03 10:40:54 -08:00 committed by Commit bot
parent be5cfa9a9e
commit 65dfd2fe5d

View File

@ -112,6 +112,11 @@ DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
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 @@ public:
}
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();