Specify bench_type & source_type for image benches

This will allow us to use perf filtering for comparing SkImageDecoder
to SkCodec.

BUG=skia:3418

Review URL: https://codereview.chromium.org/1387863002
This commit is contained in:
scroggo 2015-10-05 11:03:34 -07:00 committed by Commit bot
parent 1f7039c6c5
commit 303fa35012

View File

@ -790,8 +790,9 @@ public:
} }
} }
for (; fCurrentCodec < fImages.count(); fCurrentCodec++) { for (; fCurrentCodec < fImages.count(); fCurrentCodec++) {
fSourceType = "image";
fBenchType = "skcodec";
const SkString& path = fImages[fCurrentCodec]; const SkString& path = fImages[fCurrentCodec];
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
@ -845,6 +846,8 @@ public:
// Run the DecodingBenches // Run the DecodingBenches
while (fCurrentImage < fImages.count()) { while (fCurrentImage < fImages.count()) {
fSourceType = "image";
fBenchType = "skimagedecoder";
while (fCurrentColorType < fColorTypes.count()) { while (fCurrentColorType < fColorTypes.count()) {
const SkString& path = fImages[fCurrentImage]; const SkString& path = fImages[fCurrentImage];
SkColorType colorType = fColorTypes[fCurrentColorType]; SkColorType colorType = fColorTypes[fCurrentColorType];
@ -866,6 +869,8 @@ public:
bool useCodecOpts[] = { true, false }; bool useCodecOpts[] = { true, false };
while (fUseCodec < 2) { while (fUseCodec < 2) {
bool useCodec = useCodecOpts[fUseCodec]; bool useCodec = useCodecOpts[fUseCodec];
fSourceType = "image";
fBenchType = useCodec ? "skcodec" : "skimagedecoder";
while (fCurrentSubsetImage < fImages.count()) { while (fCurrentSubsetImage < fImages.count()) {
while (fCurrentColorType < fColorTypes.count()) { while (fCurrentColorType < fColorTypes.count()) {
const SkString& path = fImages[fCurrentSubsetImage]; const SkString& path = fImages[fCurrentSubsetImage];
@ -914,9 +919,12 @@ public:
// Run the BRDBenches // Run the BRDBenches
// We will benchmark multiple BRD strategies. // We will benchmark multiple BRD strategies.
const SkBitmapRegionDecoderInterface::Strategy strategies[] = { static const struct {
SkBitmapRegionDecoderInterface::kOriginal_Strategy, SkBitmapRegionDecoderInterface::Strategy fStrategy;
SkBitmapRegionDecoderInterface::kCanvas_Strategy, const char* fName;
} strategies[] = {
{ SkBitmapRegionDecoderInterface::kOriginal_Strategy, "BRD" },
{ SkBitmapRegionDecoderInterface::kCanvas_Strategy, "BRD_canvas" },
}; };
// We intend to create benchmarks that model the use cases in // We intend to create benchmarks that model the use cases in
@ -937,12 +945,14 @@ public:
const uint32_t minOutputSize = 512; const uint32_t minOutputSize = 512;
while (fCurrentBRDImage < fImages.count()) { while (fCurrentBRDImage < fImages.count()) {
while (fCurrentBRDStrategy < (int) SK_ARRAY_COUNT(strategies)) { while (fCurrentBRDStrategy < (int) SK_ARRAY_COUNT(strategies)) {
fSourceType = "image";
fBenchType = strategies[fCurrentBRDStrategy].fName;
while (fCurrentColorType < fColorTypes.count()) { while (fCurrentColorType < fColorTypes.count()) {
while (fCurrentBRDSampleSize < (int) SK_ARRAY_COUNT(sampleSizes)) { while (fCurrentBRDSampleSize < (int) SK_ARRAY_COUNT(sampleSizes)) {
while (fCurrentSubsetType <= kLastSingle_SubsetType) { while (fCurrentSubsetType <= kLastSingle_SubsetType) {
const SkString& path = fImages[fCurrentBRDImage]; const SkString& path = fImages[fCurrentBRDImage];
const SkBitmapRegionDecoderInterface::Strategy strategy = const SkBitmapRegionDecoderInterface::Strategy strategy =
strategies[fCurrentBRDStrategy]; strategies[fCurrentBRDStrategy].fStrategy;
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
const SkColorType colorType = fColorTypes[fCurrentColorType]; const SkColorType colorType = fColorTypes[fCurrentColorType];
uint32_t sampleSize = sampleSizes[fCurrentBRDSampleSize]; uint32_t sampleSize = sampleSizes[fCurrentBRDSampleSize];