Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: bench/nanobench.cpp

Issue 1396613007: Stop benching PNG buildTileIndex by default (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <ctype.h> 8 #include <ctype.h>
9 9
10 #include "nanobench.h" 10 #include "nanobench.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); 104 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
105 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); 105 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
106 DEFINE_string(zoom, "1.0,0", "Comma-separated zoomMax,zoomPeriodMs factors for a periodic SKP zoom " 106 DEFINE_string(zoom, "1.0,0", "Comma-separated zoomMax,zoomPeriodMs factors for a periodic SKP zoom "
107 "function that ping-pongs between 1.0 and zoomMax." ); 107 "function that ping-pongs between 1.0 and zoomMax." );
108 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); 108 DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
109 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?"); 109 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
110 DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?"); 110 DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
111 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); 111 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
112 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test ."); 112 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test .");
113 DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?"); 113 DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
114 DEFINE_bool(pngBuildTileIndex, false, "If supported, use png buildTileIndex/deco deSubset.");
114 115
115 static SkString humanize(double ms) { 116 static SkString humanize(double ms) {
116 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); 117 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
117 return HumanizeMs(ms); 118 return HumanizeMs(ms);
118 } 119 }
119 #define HUMANIZE(ms) humanize(ms).c_str() 120 #define HUMANIZE(ms) humanize(ms).c_str()
120 121
121 bool Target::init(SkImageInfo info, Benchmark* bench) { 122 bool Target::init(SkImageInfo info, Benchmark* bench) {
122 if (Benchmark::kRaster_Backend == config.backend) { 123 if (Benchmark::kRaster_Backend == config.backend) {
123 this->surface.reset(SkSurface::NewRaster(info)); 124 this->surface.reset(SkSurface::NewRaster(info));
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 502 }
502 503
503 /* 504 /*
504 * We only run our subset benches on files that are supported by BitmapRegionDec oder: 505 * We only run our subset benches on files that are supported by BitmapRegionDec oder:
505 * i.e. PNG, JPEG, and WEBP. We do *not* test WEBP when using codec, since we do not 506 * i.e. PNG, JPEG, and WEBP. We do *not* test WEBP when using codec, since we do not
506 * have a scanline decoder for WEBP, which is necessary for running the subset b ench. 507 * have a scanline decoder for WEBP, which is necessary for running the subset b ench.
507 * (Another bench must be used to test WEBP, which decodes subsets natively.) 508 * (Another bench must be used to test WEBP, which decodes subsets natively.)
508 */ 509 */
509 static bool run_subset_bench(const SkString& path, bool useCodec) { 510 static bool run_subset_bench(const SkString& path, bool useCodec) {
510 static const char* const exts[] = { 511 static const char* const exts[] = {
511 "jpg", "jpeg", "png", 512 "jpg", "jpeg",
512 "JPG", "JPEG", "PNG", 513 "JPG", "JPEG",
513 }; 514 };
514 515
515 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { 516 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
516 if (path.endsWith(exts[i])) { 517 if (path.endsWith(exts[i])) {
517 return true; 518 return true;
518 } 519 }
519 } 520 }
520 521
521 return !useCodec && (path.endsWith("webp") || path.endsWith("WEBP")); 522 // Test png in SkCodec, and optionally on SkImageDecoder. SkImageDecoder is
523 // disabled by default because it leaks memory.
524 // skbug.com/4360
525 if ((useCodec || FLAGS_pngBuildTileIndex) && (path.endsWith("png") || path.e ndsWith("PNG"))) {
526 return true;
527 }
528
529 if (!useCodec && (path.endsWith("webp") || path.endsWith("WEBP"))) {
530 return true;
531 }
532
533 return false;
522 } 534 }
523 535
524 /* 536 /*
525 * Returns true if set up for a subset decode succeeds, false otherwise 537 * Returns true if set up for a subset decode succeeds, false otherwise
526 * If the set-up succeeds, the width and height parameters will be set 538 * If the set-up succeeds, the width and height parameters will be set
527 */ 539 */
528 static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool useCodec, 540 static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool useCodec,
529 int* width, int* height) { 541 int* width, int* height) {
530 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); 542 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
531 SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encoded)); 543 SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encoded));
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1339
1328 return 0; 1340 return 0;
1329 } 1341 }
1330 1342
1331 #if !defined SK_BUILD_FOR_IOS 1343 #if !defined SK_BUILD_FOR_IOS
1332 int main(int argc, char** argv) { 1344 int main(int argc, char** argv) {
1333 SkCommandLineFlags::Parse(argc, argv); 1345 SkCommandLineFlags::Parse(argc, argv);
1334 return nanobench_main(); 1346 return nanobench_main();
1335 } 1347 }
1336 #endif 1348 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698