| 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 "BenchLogger.h" | 8 #include "BenchLogger.h" |
| 9 #include "Timer.h" | 9 #include "Timer.h" |
| 10 #include "CopyTilesRenderer.h" | 10 #include "CopyTilesRenderer.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 " for each picture."); | 52 " for each picture."); |
| 53 DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecod
ing and " | 53 DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecod
ing and " |
| 54 "SK_LAZY_CACHE_STATS set to true. Report percentage of cache hits wh
en using " | 54 "SK_LAZY_CACHE_STATS set to true. Report percentage of cache hits wh
en using " |
| 55 "deferred image decoding."); | 55 "deferred image decoding."); |
| 56 | 56 |
| 57 #if GR_GPU_STATS | 57 #if GR_GPU_STATS |
| 58 DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " | 58 DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " |
| 59 "Report some GPU call statistics."); | 59 "Report some GPU call statistics."); |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b
efore timing."); | 62 DEFINE_bool(mpd, false, "If true, use MultiPictureDraw to render."); |
| 63 | 63 |
| 64 // Buildbot-specific parameters | 64 // Buildbot-specific parameters |
| 65 DEFINE_string(builderName, "", "Name of the builder this is running on."); | 65 DEFINE_string(builderName, "", "Name of the builder this is running on."); |
| 66 DEFINE_int32(buildNumber, -1, "Build number of the build this test is running on
"); | 66 DEFINE_int32(buildNumber, -1, "Build number of the build this test is running on
"); |
| 67 DEFINE_int32(timestamp, 0, "Timestamp of the revision of Skia being tested."); | 67 DEFINE_int32(timestamp, 0, "Timestamp of the revision of Skia being tested."); |
| 68 DEFINE_string(gitHash, "", "Commit hash of the revision of Skia being run."); | 68 DEFINE_string(gitHash, "", "Commit hash of the revision of Skia being run."); |
| 69 DEFINE_int32(gitNumber, -1, "Git number of the revision of Skia being run."); | 69 DEFINE_int32(gitNumber, -1, "Git number of the revision of Skia being run."); |
| 70 | 70 |
| 71 | 71 |
| 72 static char const * const gFilterTypes[] = { | 72 static char const * const gFilterTypes[] = { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 196 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
| 197 | 197 |
| 198 if (NULL == picture.get()) { | 198 if (NULL == picture.get()) { |
| 199 SkString err; | 199 SkString err; |
| 200 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 200 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
| 201 gLogger.logError(err); | 201 gLogger.logError(err); |
| 202 return false; | 202 return false; |
| 203 } | 203 } |
| 204 | 204 |
| 205 if (FLAGS_preprocess) { | |
| 206 // Because the GPU preprocessing step relies on the in-memory picture | |
| 207 // statistics we need to rerecord the picture here | |
| 208 SkPictureRecorder recorder; | |
| 209 picture->playback(recorder.beginRecording(picture->cullRect().width(), | |
| 210 picture->cullRect().height(), | |
| 211 NULL, 0)); | |
| 212 picture.reset(recorder.endRecording()); | |
| 213 } | |
| 214 | |
| 215 SkString filename = SkOSPath::Basename(inputPath.c_str()); | 205 SkString filename = SkOSPath::Basename(inputPath.c_str()); |
| 216 | 206 |
| 217 gWriter.bench(filename.c_str(), | 207 gWriter.bench(filename.c_str(), |
| 218 SkScalarCeilToInt(picture->cullRect().width()), | 208 SkScalarCeilToInt(picture->cullRect().width()), |
| 219 SkScalarCeilToInt(picture->cullRect().height())); | 209 SkScalarCeilToInt(picture->cullRect().height())); |
| 220 | 210 |
| 221 benchmark.run(picture); | 211 benchmark.run(picture, FLAGS_mpd); |
| 222 | 212 |
| 223 #if SK_LAZY_CACHE_STATS | 213 #if SK_LAZY_CACHE_STATS |
| 224 if (FLAGS_trackDeferredCaching) { | 214 if (FLAGS_trackDeferredCaching) { |
| 225 int cacheHits = pool->getCacheHits(); | 215 int cacheHits = pool->getCacheHits(); |
| 226 int cacheMisses = pool->getCacheMisses(); | 216 int cacheMisses = pool->getCacheMisses(); |
| 227 pool->resetCacheHitsAndMisses(); | 217 pool->resetCacheHitsAndMisses(); |
| 228 SkString hitString; | 218 SkString hitString; |
| 229 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); | 219 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits
+ cacheMisses)); |
| 230 gLogger.logProgress(hitString); | 220 gLogger.logProgress(hitString); |
| 231 gTotalCacheHits += cacheHits; | 221 gTotalCacheHits += cacheHits; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 exit(-1); | 348 exit(-1); |
| 359 } | 349 } |
| 360 if (!tiledRenderer->supportsTimingIndividualTiles()) { | 350 if (!tiledRenderer->supportsTimingIndividualTiles()) { |
| 361 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); | 351 gLogger.logError("This renderer does not support --timeIndividualTil
es.\n"); |
| 362 exit(-1); | 352 exit(-1); |
| 363 } | 353 } |
| 364 benchmark->setTimeIndividualTiles(true); | 354 benchmark->setTimeIndividualTiles(true); |
| 365 } | 355 } |
| 366 | 356 |
| 367 benchmark->setPurgeDecodedTex(FLAGS_purgeDecodedTex); | 357 benchmark->setPurgeDecodedTex(FLAGS_purgeDecodedTex); |
| 368 benchmark->setPreprocess(FLAGS_preprocess); | |
| 369 | 358 |
| 370 if (FLAGS_readPath.count() < 1) { | 359 if (FLAGS_readPath.count() < 1) { |
| 371 gLogger.logError(".skp files or directories are required.\n"); | 360 gLogger.logError(".skp files or directories are required.\n"); |
| 372 exit(-1); | 361 exit(-1); |
| 373 } | 362 } |
| 374 | 363 |
| 375 renderer->setDrawFilters(drawFilters, filtersName(drawFilters)); | 364 renderer->setDrawFilters(drawFilters, filtersName(drawFilters)); |
| 376 if (FLAGS_logPerIter) { | 365 if (FLAGS_logPerIter) { |
| 377 benchmark->setTimerResultType(TimerData::kPerIter_Result); | 366 benchmark->setTimerResultType(TimerData::kPerIter_Result); |
| 378 } else if (FLAGS_min) { | 367 } else if (FLAGS_min) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 481 |
| 493 gWriter.end(); | 482 gWriter.end(); |
| 494 return 0; | 483 return 0; |
| 495 } | 484 } |
| 496 | 485 |
| 497 #if !defined SK_BUILD_FOR_IOS | 486 #if !defined SK_BUILD_FOR_IOS |
| 498 int main(int argc, char * const argv[]) { | 487 int main(int argc, char * const argv[]) { |
| 499 return tool_main(argc, (char**) argv); | 488 return tool_main(argc, (char**) argv); |
| 500 } | 489 } |
| 501 #endif | 490 #endif |
| OLD | NEW |