apply --match to image file names too, like we do for .skps

This should make skipping an image much cheaper.

Before:
   $ time out/Release/nanobench --images resources/ --match sdkjlfasjlfds
        4.65 real         4.41 user         0.19 sys
   $ time out/Release/nanobench --images resources/ --match sdkjlfasjlfds
        0.05 real         0.03 user         0.01 sys

The effect should be much more dramatic when there are more images to skip (e.g. on the bots).
This cuts about 6 minutes off the Debug CQ trybot.

BUG=skia:4768
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1577873002

Review URL: https://codereview.chromium.org/1577873002
This commit is contained in:
mtklein 2016-01-11 09:04:21 -08:00 committed by Commit bot
parent 4897ff20fc
commit 6f0ff91c65

View File

@ -743,6 +743,9 @@ public:
fSourceType = "image";
fBenchType = "skcodec";
const SkString& path = fImages[fCurrentCodec];
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
continue;
}
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
if (!codec) {
@ -810,11 +813,14 @@ public:
}
// Run the DecodingBenches
while (fCurrentImage < fImages.count()) {
for (; fCurrentImage < fImages.count(); fCurrentImage++) {
fSourceType = "image";
fBenchType = "skimagedecoder";
const SkString& path = fImages[fCurrentImage];
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
continue;
}
while (fCurrentColorType < fColorTypes.count()) {
const SkString& path = fImages[fCurrentImage];
SkColorType colorType = fColorTypes[fCurrentColorType];
fCurrentColorType++;
// Check if the image decodes to the right color type
@ -827,7 +833,6 @@ public:
}
}
fCurrentColorType = 0;
fCurrentImage++;
}
// Run the BRDBenches
@ -856,12 +861,15 @@ public:
// these tests are sufficient to provide good coverage of our scaling options.
const uint32_t sampleSizes[] = { 1, 2, 4, 8, 16, 32, 64 };
const uint32_t minOutputSize = 512;
while (fCurrentBRDImage < fImages.count()) {
for (; fCurrentBRDImage < fImages.count(); fCurrentBRDImage++) {
const SkString& path = fImages[fCurrentBRDImage];
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
continue;
}
while (fCurrentBRDStrategy < (int) SK_ARRAY_COUNT(strategies)) {
fSourceType = "image";
fBenchType = strategies[fCurrentBRDStrategy].fName;
const SkString& path = fImages[fCurrentBRDImage];
const SkBitmapRegionDecoder::Strategy strategy =
strategies[fCurrentBRDStrategy].fStrategy;
@ -927,7 +935,6 @@ public:
fCurrentBRDStrategy++;
}
fCurrentBRDStrategy = 0;
fCurrentBRDImage++;
}
return nullptr;