| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "PictureBenchmark.h" | 10 #include "PictureBenchmark.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 "type:flag : Enable canvas filtering to disable a paint flag, " | 33 "type:flag : Enable canvas filtering to disable a paint flag, " |
| 34 "use no blur or low quality blur, or use no hinting or " | 34 "use no blur or low quality blur, or use no hinting or " |
| 35 "slight hinting. For all flags except AAClip, specify the " | 35 "slight hinting. For all flags except AAClip, specify the " |
| 36 "type of primitive to effect, or choose all. for AAClip " | 36 "type of primitive to effect, or choose all. for AAClip " |
| 37 "alone, the filter affects all clips independent of type. " | 37 "alone, the filter affects all clips independent of type. " |
| 38 "Specific flags are listed above."); | 38 "Specific flags are listed above."); |
| 39 DEFINE_string(logFile, "", "Destination for writing log output, in addition to s
tdout."); | 39 DEFINE_string(logFile, "", "Destination for writing log output, in addition to s
tdout."); |
| 40 DEFINE_bool(logPerIter, false, "Log each repeat timer instead of mean."); | 40 DEFINE_bool(logPerIter, false, "Log each repeat timer instead of mean."); |
| 41 DEFINE_bool(min, false, "Print the minimum times (instead of average)."); | 41 DEFINE_bool(min, false, "Print the minimum times (instead of average)."); |
| 42 DECLARE_int32(multi); | 42 DECLARE_int32(multi); |
| 43 DECLARE_string(r); | 43 DECLARE_string(readPath); |
| 44 DEFINE_int32(repeat, 1, "Set the number of times to repeat each test."); | 44 DEFINE_int32(repeat, 1, "Set the number of times to repeat each test."); |
| 45 DEFINE_bool(timeIndividualTiles, false, "Report times for drawing individual til
es, rather than " | 45 DEFINE_bool(timeIndividualTiles, false, "Report times for drawing individual til
es, rather than " |
| 46 "times for drawing the whole page. Requires tiled rendering."); | 46 "times for drawing the whole page. Requires tiled rendering."); |
| 47 DEFINE_string(timers, "", "[wcgWC]*: Display wall, cpu, gpu, truncated wall or t
runcated cpu time" | 47 DEFINE_string(timers, "", "[wcgWC]*: Display wall, cpu, gpu, truncated wall or t
runcated cpu time" |
| 48 " for each picture."); | 48 " for each picture."); |
| 49 DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecod
ing and " | 49 DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecod
ing and " |
| 50 "LAZY_CACHE_STATS set to true. Report percentage of cache hits when
using deferred " | 50 "LAZY_CACHE_STATS set to true. Report percentage of cache hits when
using deferred " |
| 51 "image decoding."); | 51 "image decoding."); |
| 52 | 52 |
| 53 static char const * const gFilterTypes[] = { | 53 static char const * const gFilterTypes[] = { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 gLogger.logError("--timeIndividualTiles requires tiled rendering.\n"
); | 338 gLogger.logError("--timeIndividualTiles requires tiled rendering.\n"
); |
| 339 exit(-1); | 339 exit(-1); |
| 340 } | 340 } |
| 341 if (!tiledRenderer->supportsTimingIndividualTiles()) { | 341 if (!tiledRenderer->supportsTimingIndividualTiles()) { |
| 342 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); | 342 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); |
| 343 exit(-1); | 343 exit(-1); |
| 344 } | 344 } |
| 345 benchmark->setTimeIndividualTiles(true); | 345 benchmark->setTimeIndividualTiles(true); |
| 346 } | 346 } |
| 347 | 347 |
| 348 if (FLAGS_r.count() < 1) { | 348 if (FLAGS_readPath.count() < 1) { |
| 349 gLogger.logError(".skp files or directories are required.\n"); | 349 gLogger.logError(".skp files or directories are required.\n"); |
| 350 exit(-1); | 350 exit(-1); |
| 351 } | 351 } |
| 352 | 352 |
| 353 renderer->setDrawFilters(drawFilters, filtersName(drawFilters)); | 353 renderer->setDrawFilters(drawFilters, filtersName(drawFilters)); |
| 354 benchmark->setPrintMin(FLAGS_min); | 354 benchmark->setPrintMin(FLAGS_min); |
| 355 benchmark->setLogPerIter(FLAGS_logPerIter); | 355 benchmark->setLogPerIter(FLAGS_logPerIter); |
| 356 benchmark->setRenderer(renderer); | 356 benchmark->setRenderer(renderer); |
| 357 benchmark->setRepeats(FLAGS_repeat); | 357 benchmark->setRepeats(FLAGS_repeat); |
| 358 benchmark->setLogger(&gLogger); | 358 benchmark->setLogger(&gLogger); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 #if SK_ENABLE_INST_COUNT | 416 #if SK_ENABLE_INST_COUNT |
| 417 gPrintInstCount = true; | 417 gPrintInstCount = true; |
| 418 #endif | 418 #endif |
| 419 SkAutoGraphics ag; | 419 SkAutoGraphics ag; |
| 420 | 420 |
| 421 sk_tools::PictureBenchmark benchmark; | 421 sk_tools::PictureBenchmark benchmark; |
| 422 | 422 |
| 423 setup_benchmark(&benchmark); | 423 setup_benchmark(&benchmark); |
| 424 | 424 |
| 425 int failures = 0; | 425 int failures = 0; |
| 426 for (int i = 0; i < FLAGS_r.count(); ++i) { | 426 for (int i = 0; i < FLAGS_readPath.count(); ++i) { |
| 427 failures += process_input(FLAGS_r[i], benchmark); | 427 failures += process_input(FLAGS_readPath[i], benchmark); |
| 428 } | 428 } |
| 429 | 429 |
| 430 if (failures != 0) { | 430 if (failures != 0) { |
| 431 SkString err; | 431 SkString err; |
| 432 err.printf("Failed to run %i benchmarks.\n", failures); | 432 err.printf("Failed to run %i benchmarks.\n", failures); |
| 433 gLogger.logError(err); | 433 gLogger.logError(err); |
| 434 return 1; | 434 return 1; |
| 435 } | 435 } |
| 436 #if LAZY_CACHE_STATS | 436 #if LAZY_CACHE_STATS |
| 437 if (FLAGS_trackDeferredCaching) { | 437 if (FLAGS_trackDeferredCaching) { |
| 438 SkDebugf("Total cache hit rate: %f\n", | 438 SkDebugf("Total cache hit rate: %f\n", |
| 439 (double) gTotalCacheHits / (gTotalCacheHits + gTotalCacheMisses
)); | 439 (double) gTotalCacheHits / (gTotalCacheHits + gTotalCacheMisses
)); |
| 440 } | 440 } |
| 441 #endif | 441 #endif |
| 442 return 0; | 442 return 0; |
| 443 } | 443 } |
| 444 | 444 |
| 445 #if !defined SK_BUILD_FOR_IOS | 445 #if !defined SK_BUILD_FOR_IOS |
| 446 int main(int argc, char * const argv[]) { | 446 int main(int argc, char * const argv[]) { |
| 447 return tool_main(argc, (char**) argv); | 447 return tool_main(argc, (char**) argv); |
| 448 } | 448 } |
| 449 #endif | 449 #endif |
| OLD | NEW |