Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "BenchTimer.h" | 9 #include "BenchTimer.h" |
| 10 #include "Benchmark.h" | |
| 9 #include "CrashHandler.h" | 11 #include "CrashHandler.h" |
| 10 #include "ResultsWriter.h" | 12 #include "ResultsWriter.h" |
| 11 #include "SkBenchLogger.h" | |
| 12 #include "SkBenchmark.h" | |
| 13 #include "SkBitmapDevice.h" | 13 #include "SkBitmapDevice.h" |
| 14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 15 #include "SkColorPriv.h" | 15 #include "SkColorPriv.h" |
| 16 #include "SkCommandLineFlags.h" | 16 #include "SkCommandLineFlags.h" |
| 17 #include "SkData.h" | 17 #include "SkData.h" |
| 18 #include "SkDeferredCanvas.h" | 18 #include "SkDeferredCanvas.h" |
| 19 #include "SkGMBench.h" | 19 #include "SkGMBench.h" |
| 20 #include "SkGraphics.h" | 20 #include "SkGraphics.h" |
| 21 #include "SkImageEncoder.h" | 21 #include "SkImageEncoder.h" |
| 22 #include "SkOSFile.h" | 22 #include "SkOSFile.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static const char kDefaultsConfigStr[] = "defaults"; | 51 static const char kDefaultsConfigStr[] = "defaults"; |
| 52 | 52 |
| 53 /////////////////////////////////////////////////////////////////////////////// | 53 /////////////////////////////////////////////////////////////////////////////// |
| 54 | 54 |
| 55 class Iter { | 55 class Iter { |
| 56 public: | 56 public: |
| 57 Iter() : fBenches(BenchRegistry::Head()), fGMs(skiagm::GMRegistry::Head()) { } | 57 Iter() : fBenches(BenchRegistry::Head()), fGMs(skiagm::GMRegistry::Head()) { } |
| 58 | 58 |
| 59 SkBenchmark* next() { | 59 Benchmark* next() { |
| 60 if (fBenches) { | 60 if (fBenches) { |
| 61 BenchRegistry::Factory f = fBenches->factory(); | 61 BenchRegistry::Factory f = fBenches->factory(); |
| 62 fBenches = fBenches->next(); | 62 fBenches = fBenches->next(); |
| 63 return (*f)(NULL); | 63 return (*f)(NULL); |
| 64 } | 64 } |
| 65 | 65 |
| 66 while (fGMs) { | 66 while (fGMs) { |
| 67 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL)); | 67 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(NULL)); |
| 68 fGMs = fGMs->next(); | 68 fGMs = fGMs->next(); |
| 69 if (gm->getFlags() & skiagm::GM::kAsBench_Flag) { | 69 if (gm->getFlags() & skiagm::GM::kAsBench_Flag) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 const SkScalar x = SkIntToScalar(w) / 2; | 137 const SkScalar x = SkIntToScalar(w) / 2; |
| 138 const SkScalar y = SkIntToScalar(h) / 2; | 138 const SkScalar y = SkIntToScalar(h) / 2; |
| 139 | 139 |
| 140 canvas->translate(x, y); | 140 canvas->translate(x, y); |
| 141 // just enough so we can't take the sprite case | 141 // just enough so we can't take the sprite case |
| 142 canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); | 142 canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); |
| 143 canvas->translate(-x, -y); | 143 canvas->translate(-x, -y); |
| 144 } | 144 } |
| 145 | 145 |
| 146 static SkSurface* make_surface(SkColorType colorType, const SkIPoint& size, | 146 static SkSurface* make_surface(SkColorType colorType, const SkIPoint& size, |
| 147 SkBenchmark::Backend backend, int sampleCount, | 147 Benchmark::Backend backend, int sampleCount, |
| 148 GrContext* context) { | 148 GrContext* context) { |
| 149 SkSurface* surface = NULL; | 149 SkSurface* surface = NULL; |
| 150 SkImageInfo info = SkImageInfo::Make(size.fX, size.fY, colorType, | 150 SkImageInfo info = SkImageInfo::Make(size.fX, size.fY, colorType, |
| 151 kPremul_SkAlphaType); | 151 kPremul_SkAlphaType); |
| 152 | 152 |
| 153 switch (backend) { | 153 switch (backend) { |
| 154 case SkBenchmark::kRaster_Backend: | 154 case Benchmark::kRaster_Backend: |
| 155 surface = SkSurface::NewRaster(info); | 155 surface = SkSurface::NewRaster(info); |
| 156 surface->getCanvas()->clear(SK_ColorWHITE); | 156 surface->getCanvas()->clear(SK_ColorWHITE); |
| 157 break; | 157 break; |
| 158 #if SK_SUPPORT_GPU | 158 #if SK_SUPPORT_GPU |
| 159 case SkBenchmark::kGPU_Backend: { | 159 case Benchmark::kGPU_Backend: { |
| 160 surface = SkSurface::NewRenderTarget(context, info, sampleCount); | 160 surface = SkSurface::NewRenderTarget(context, info, sampleCount); |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 #endif | 163 #endif |
| 164 case SkBenchmark::kPDF_Backend: | 164 case Benchmark::kPDF_Backend: |
| 165 default: | 165 default: |
| 166 SkDEBUGFAIL("unsupported"); | 166 SkDEBUGFAIL("unsupported"); |
| 167 } | 167 } |
| 168 return surface; | 168 return surface; |
| 169 } | 169 } |
| 170 | 170 |
| 171 #if SK_SUPPORT_GPU | 171 #if SK_SUPPORT_GPU |
| 172 GrContextFactory gContextFactory; | 172 GrContextFactory gContextFactory; |
| 173 typedef GrContextFactory::GLContextType GLContextType; | 173 typedef GrContextFactory::GLContextType GLContextType; |
| 174 static const GLContextType kNative = GrContextFactory::kNative_GLContextType; | 174 static const GLContextType kNative = GrContextFactory::kNative_GLContextType; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 186 #ifdef SK_DEBUG | 186 #ifdef SK_DEBUG |
| 187 static const bool kIsDebug = true; | 187 static const bool kIsDebug = true; |
| 188 #else | 188 #else |
| 189 static const bool kIsDebug = false; | 189 static const bool kIsDebug = false; |
| 190 #endif | 190 #endif |
| 191 | 191 |
| 192 static const struct Config { | 192 static const struct Config { |
| 193 SkColorType fColorType; | 193 SkColorType fColorType; |
| 194 const char* name; | 194 const char* name; |
| 195 int sampleCount; | 195 int sampleCount; |
| 196 SkBenchmark::Backend backend; | 196 Benchmark::Backend backend; |
|
mtklein
2014/06/19 18:45:17
Line this guy up again?
tfarina
2014/06/19 19:02:01
Done.
| |
| 197 GLContextType contextType; | 197 GLContextType contextType; |
| 198 bool runByDefault; | 198 bool runByDefault; |
| 199 } gConfigs[] = { | 199 } gConfigs[] = { |
| 200 { kN32_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backen d, kNative, true}, | 200 { kN32_SkColorType, "NONRENDERING", 0, Benchmark::kNonRendering_Backend, kNative, true}, |
| 201 { kN32_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true}, | 201 { kN32_SkColorType, "8888", 0, Benchmark::kRaster_Backend, kNative, true}, |
| 202 { kRGB_565_SkColorType, "565", 0, SkBenchmark::kRaster_Backend, kNative, true}, | 202 { kRGB_565_SkColorType, "565", 0, Benchmark::kRaster_Backend, kNative, true}, |
| 203 #if SK_SUPPORT_GPU | 203 #if SK_SUPPORT_GPU |
| 204 { kN32_SkColorType, "GPU", 0, SkBenchmark::kGPU_Backend, kNative, true}, | 204 { kN32_SkColorType, "GPU", 0, Benchmark::kGPU_Backend, kNative, true}, |
| 205 { kN32_SkColorType, "MSAA4", 4, SkBenchmark::kGPU_Backend, kNative, false}, | 205 { kN32_SkColorType, "MSAA4", 4, Benchmark::kGPU_Backend, kNative, false}, |
| 206 { kN32_SkColorType, "MSAA16", 16, SkBenchmark::kGPU_Backend, kNative, false}, | 206 { kN32_SkColorType, "MSAA16", 16, Benchmark::kGPU_Backend, kNative, false}, |
| 207 { kN32_SkColorType, "NVPRMSAA4", 4, SkBenchmark::kGPU_Backend, kNVPR, true}, | 207 { kN32_SkColorType, "NVPRMSAA4", 4, Benchmark::kGPU_Backend, kNVPR, true}, |
| 208 { kN32_SkColorType, "NVPRMSAA16", 16, SkBenchmark::kGPU_Backend, kNVPR, false}, | 208 { kN32_SkColorType, "NVPRMSAA16", 16, Benchmark::kGPU_Backend, kNVPR, false}, |
| 209 #if SK_ANGLE | 209 #if SK_ANGLE |
| 210 { kN32_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true}, | 210 { kN32_SkColorType, "ANGLE", 0, Benchmark::kGPU_Backend, kANGLE, true}, |
| 211 #endif // SK_ANGLE | 211 #endif // SK_ANGLE |
| 212 { kN32_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug}, | 212 { kN32_SkColorType, "Debug", 0, Benchmark::kGPU_Backend, kDebug, kIsDebug}, |
| 213 { kN32_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true}, | 213 { kN32_SkColorType, "NULLGPU", 0, Benchmark::kGPU_Backend, kNull, true}, |
| 214 #endif // SK_SUPPORT_GPU | 214 #endif // SK_SUPPORT_GPU |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 DEFINE_string(outDir, "", "If given, image of each bench will be put in outDir." ); | 217 DEFINE_string(outDir, "", "If given, image of each bench will be put in outDir." ); |
| 218 DEFINE_string(timers, "cg", "Timers to display. " | 218 DEFINE_string(timers, "cg", "Timers to display. " |
| 219 "Options: w(all) W(all, truncated) c(pu) C(pu, truncated) g(pu)"); | 219 "Options: w(all) W(all, truncated) c(pu) C(pu, truncated) g(pu)"); |
| 220 | 220 |
| 221 DEFINE_bool(rotate, false, "Rotate canvas before bench run?"); | 221 DEFINE_bool(rotate, false, "Rotate canvas before bench run?"); |
| 222 DEFINE_bool(scale, false, "Scale canvas before bench run?"); | 222 DEFINE_bool(scale, false, "Scale canvas before bench run?"); |
| 223 DEFINE_bool(clip, false, "Clip canvas before bench run?"); | 223 DEFINE_bool(clip, false, "Clip canvas before bench run?"); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 SetupCrashHandler(); | 274 SetupCrashHandler(); |
| 275 SkCommandLineFlags::Parse(argc, argv); | 275 SkCommandLineFlags::Parse(argc, argv); |
| 276 #if SK_ENABLE_INST_COUNT | 276 #if SK_ENABLE_INST_COUNT |
| 277 if (FLAGS_leaks) { | 277 if (FLAGS_leaks) { |
| 278 gPrintInstCount = true; | 278 gPrintInstCount = true; |
| 279 } | 279 } |
| 280 #endif | 280 #endif |
| 281 SkAutoGraphics ag; | 281 SkAutoGraphics ag; |
| 282 | 282 |
| 283 // First, parse some flags. | 283 // First, parse some flags. |
| 284 SkBenchLogger logger; | 284 BenchLogger logger; |
| 285 if (FLAGS_logFile.count()) { | 285 if (FLAGS_logFile.count()) { |
| 286 logger.SetLogFile(FLAGS_logFile[0]); | 286 logger.SetLogFile(FLAGS_logFile[0]); |
| 287 } | 287 } |
| 288 | 288 |
| 289 LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]); | 289 LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]); |
| 290 MultiResultsWriter writer; | 290 MultiResultsWriter writer; |
| 291 writer.add(&logWriter); | 291 writer.add(&logWriter); |
| 292 | 292 |
| 293 SkAutoTDelete<JSONResultsWriter> jsonWriter; | 293 SkAutoTDelete<JSONResultsWriter> jsonWriter; |
| 294 if (FLAGS_outResultsFile.count()) { | 294 if (FLAGS_outResultsFile.count()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 if (gConfigs[i].runByDefault) { | 333 if (gConfigs[i].runByDefault) { |
| 334 *configs.append() = i; | 334 *configs.append() = i; |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 // Filter out things we can't run. | 338 // Filter out things we can't run. |
| 339 if (kNormal_BenchMode != benchMode) { | 339 if (kNormal_BenchMode != benchMode) { |
| 340 // Non-rendering configs only run in normal mode | 340 // Non-rendering configs only run in normal mode |
| 341 for (int i = 0; i < configs.count(); ++i) { | 341 for (int i = 0; i < configs.count(); ++i) { |
| 342 const Config& config = gConfigs[configs[i]]; | 342 const Config& config = gConfigs[configs[i]]; |
| 343 if (SkBenchmark::kNonRendering_Backend == config.backend) { | 343 if (Benchmark::kNonRendering_Backend == config.backend) { |
| 344 configs.remove(i, 1); | 344 configs.remove(i, 1); |
| 345 --i; | 345 --i; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 #if SK_SUPPORT_GPU | 350 #if SK_SUPPORT_GPU |
| 351 for (int i = 0; i < configs.count(); ++i) { | 351 for (int i = 0; i < configs.count(); ++i) { |
| 352 const Config& config = gConfigs[configs[i]]; | 352 const Config& config = gConfigs[configs[i]]; |
| 353 | 353 |
| 354 if (SkBenchmark::kGPU_Backend == config.backend) { | 354 if (Benchmark::kGPU_Backend == config.backend) { |
| 355 GrContext* context = gContextFactory.get(config.contextType); | 355 GrContext* context = gContextFactory.get(config.contextType); |
| 356 if (NULL == context) { | 356 if (NULL == context) { |
| 357 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n", | 357 SkDebugf("GrContext could not be created for config %s. Config w ill be skipped.\n", |
| 358 config.name); | 358 config.name); |
| 359 configs.remove(i); | 359 configs.remove(i); |
| 360 --i; | 360 --i; |
| 361 continue; | 361 continue; |
| 362 } | 362 } |
| 363 if (config.sampleCount > context->getMaxSampleCount()){ | 363 if (config.sampleCount > context->getMaxSampleCount()){ |
| 364 SkDebugf( | 364 SkDebugf( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 #if defined(SK_DEBUG) | 402 #if defined(SK_DEBUG) |
| 403 writer.option("build", "DEBUG"); | 403 writer.option("build", "DEBUG"); |
| 404 #else | 404 #else |
| 405 writer.option("build", "RELEASE"); | 405 writer.option("build", "RELEASE"); |
| 406 #endif | 406 #endif |
| 407 | 407 |
| 408 // Set texture cache limits if non-default. | 408 // Set texture cache limits if non-default. |
| 409 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { | 409 for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { |
| 410 #if SK_SUPPORT_GPU | 410 #if SK_SUPPORT_GPU |
| 411 const Config& config = gConfigs[i]; | 411 const Config& config = gConfigs[i]; |
| 412 if (SkBenchmark::kGPU_Backend != config.backend) { | 412 if (Benchmark::kGPU_Backend != config.backend) { |
| 413 continue; | 413 continue; |
| 414 } | 414 } |
| 415 GrContext* context = gContextFactory.get(config.contextType); | 415 GrContext* context = gContextFactory.get(config.contextType); |
| 416 if (NULL == context) { | 416 if (NULL == context) { |
| 417 continue; | 417 continue; |
| 418 } | 418 } |
| 419 | 419 |
| 420 size_t bytes; | 420 size_t bytes; |
| 421 int count; | 421 int count; |
| 422 context->getResourceCacheLimits(&count, &bytes); | 422 context->getResourceCacheLimits(&count, &bytes); |
| 423 if (-1 != FLAGS_gpuCacheBytes) { | 423 if (-1 != FLAGS_gpuCacheBytes) { |
| 424 bytes = static_cast<size_t>(FLAGS_gpuCacheBytes); | 424 bytes = static_cast<size_t>(FLAGS_gpuCacheBytes); |
| 425 } | 425 } |
| 426 if (-1 != FLAGS_gpuCacheCount) { | 426 if (-1 != FLAGS_gpuCacheCount) { |
| 427 count = FLAGS_gpuCacheCount; | 427 count = FLAGS_gpuCacheCount; |
| 428 } | 428 } |
| 429 context->setResourceCacheLimits(count, bytes); | 429 context->setResourceCacheLimits(count, bytes); |
| 430 #endif | 430 #endif |
| 431 } | 431 } |
| 432 | 432 |
| 433 // Run each bench in each configuration it supports and we asked for. | 433 // Run each bench in each configuration it supports and we asked for. |
| 434 Iter iter; | 434 Iter iter; |
| 435 SkBenchmark* bench; | 435 Benchmark* bench; |
| 436 while ((bench = iter.next()) != NULL) { | 436 while ((bench = iter.next()) != NULL) { |
| 437 SkAutoTUnref<SkBenchmark> benchUnref(bench); | 437 SkAutoTUnref<Benchmark> benchUnref(bench); |
| 438 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { | 438 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { |
| 439 continue; | 439 continue; |
| 440 } | 440 } |
| 441 | 441 |
| 442 bench->setForceAlpha(alpha); | 442 bench->setForceAlpha(alpha); |
| 443 bench->setForceAA(FLAGS_forceAA); | 443 bench->setForceAA(FLAGS_forceAA); |
| 444 bench->setForceFilter(FLAGS_forceFilter); | 444 bench->setForceFilter(FLAGS_forceFilter); |
| 445 bench->setDither(dither); | 445 bench->setDither(dither); |
| 446 bench->preDraw(); | 446 bench->preDraw(); |
| 447 | 447 |
| 448 bool loggedBenchName = false; | 448 bool loggedBenchName = false; |
| 449 for (int i = 0; i < configs.count(); ++i) { | 449 for (int i = 0; i < configs.count(); ++i) { |
| 450 const int configIndex = configs[i]; | 450 const int configIndex = configs[i]; |
| 451 const Config& config = gConfigs[configIndex]; | 451 const Config& config = gConfigs[configIndex]; |
| 452 | 452 |
| 453 if (!bench->isSuitableFor(config.backend)) { | 453 if (!bench->isSuitableFor(config.backend)) { |
| 454 continue; | 454 continue; |
| 455 } | 455 } |
| 456 | 456 |
| 457 GrContext* context = NULL; | 457 GrContext* context = NULL; |
| 458 #if SK_SUPPORT_GPU | 458 #if SK_SUPPORT_GPU |
| 459 SkGLContextHelper* glContext = NULL; | 459 SkGLContextHelper* glContext = NULL; |
| 460 if (SkBenchmark::kGPU_Backend == config.backend) { | 460 if (Benchmark::kGPU_Backend == config.backend) { |
| 461 context = gContextFactory.get(config.contextType); | 461 context = gContextFactory.get(config.contextType); |
| 462 if (NULL == context) { | 462 if (NULL == context) { |
| 463 continue; | 463 continue; |
| 464 } | 464 } |
| 465 glContext = gContextFactory.getGLContext(config.contextType); | 465 glContext = gContextFactory.getGLContext(config.contextType); |
| 466 } | 466 } |
| 467 #endif | 467 #endif |
| 468 | 468 |
| 469 SkAutoTUnref<SkCanvas> canvas; | 469 SkAutoTUnref<SkCanvas> canvas; |
| 470 SkAutoTUnref<SkPicture> recordFrom; | 470 SkAutoTUnref<SkPicture> recordFrom; |
| 471 SkPictureRecorder recorderTo; | 471 SkPictureRecorder recorderTo; |
| 472 const SkIPoint dim = bench->getSize(); | 472 const SkIPoint dim = bench->getSize(); |
| 473 | 473 |
| 474 SkAutoTUnref<SkSurface> surface; | 474 SkAutoTUnref<SkSurface> surface; |
| 475 if (SkBenchmark::kNonRendering_Backend != config.backend) { | 475 if (Benchmark::kNonRendering_Backend != config.backend) { |
| 476 surface.reset(make_surface(config.fColorType, | 476 surface.reset(make_surface(config.fColorType, |
| 477 dim, | 477 dim, |
| 478 config.backend, | 478 config.backend, |
| 479 config.sampleCount, | 479 config.sampleCount, |
| 480 context)); | 480 context)); |
| 481 if (!surface.get()) { | 481 if (!surface.get()) { |
| 482 logger.logError(SkStringPrintf( | 482 logger.logError(SkStringPrintf( |
| 483 "Device creation failure for config %s. Will skip.\n", c onfig.name)); | 483 "Device creation failure for config %s. Will skip.\n", c onfig.name)); |
| 484 continue; | 484 continue; |
| 485 } | 485 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 } | 520 } |
| 521 } | 521 } |
| 522 | 522 |
| 523 if (!loggedBenchName) { | 523 if (!loggedBenchName) { |
| 524 loggedBenchName = true; | 524 loggedBenchName = true; |
| 525 writer.bench(bench->getName(), dim.fX, dim.fY); | 525 writer.bench(bench->getName(), dim.fX, dim.fY); |
| 526 } | 526 } |
| 527 | 527 |
| 528 #if SK_SUPPORT_GPU | 528 #if SK_SUPPORT_GPU |
| 529 SkGLContextHelper* contextHelper = NULL; | 529 SkGLContextHelper* contextHelper = NULL; |
| 530 if (SkBenchmark::kGPU_Backend == config.backend) { | 530 if (Benchmark::kGPU_Backend == config.backend) { |
| 531 contextHelper = gContextFactory.getGLContext(config.contextType) ; | 531 contextHelper = gContextFactory.getGLContext(config.contextType) ; |
| 532 } | 532 } |
| 533 BenchTimer timer(contextHelper); | 533 BenchTimer timer(contextHelper); |
| 534 #else | 534 #else |
| 535 BenchTimer timer; | 535 BenchTimer timer; |
| 536 #endif | 536 #endif |
| 537 | 537 |
| 538 double previous = std::numeric_limits<double>::infinity(); | 538 double previous = std::numeric_limits<double>::infinity(); |
| 539 bool converged = false; | 539 bool converged = false; |
| 540 | 540 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 | 635 |
| 636 const double current = timer.fWall / loopsPerIter; | 636 const double current = timer.fWall / loopsPerIter; |
| 637 if (FLAGS_verbose && current > previous) { SkDebugf("↑"); } | 637 if (FLAGS_verbose && current > previous) { SkDebugf("↑"); } |
| 638 if (FLAGS_verbose) { SkDebugf("%.3g ", current); } | 638 if (FLAGS_verbose) { SkDebugf("%.3g ", current); } |
| 639 converged = HasConverged(previous, current, timer.fWall); | 639 converged = HasConverged(previous, current, timer.fWall); |
| 640 previous = current; | 640 previous = current; |
| 641 } while (!FLAGS_runOnce && !converged); | 641 } while (!FLAGS_runOnce && !converged); |
| 642 } | 642 } |
| 643 if (FLAGS_verbose) { SkDebugf("\n"); } | 643 if (FLAGS_verbose) { SkDebugf("\n"); } |
| 644 | 644 |
| 645 if (!FLAGS_dryRun && FLAGS_outDir.count() && SkBenchmark::kNonRender ing_Backend != config.backend) { | 645 if (!FLAGS_dryRun && FLAGS_outDir.count() && Benchmark::kNonRenderin g_Backend != config.backend) { |
| 646 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); | 646 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); |
| 647 if (image.get()) { | 647 if (image.get()) { |
| 648 saveFile(bench->getName(), config.name, FLAGS_outDir[0], | 648 saveFile(bench->getName(), config.name, FLAGS_outDir[0], |
| 649 image); | 649 image); |
| 650 } | 650 } |
| 651 } | 651 } |
| 652 | 652 |
| 653 if (FLAGS_runOnce) { | 653 if (FLAGS_runOnce) { |
| 654 // Let's not mislead ourselves by looking at Debug build or sing le iteration bench times! | 654 // Let's not mislead ourselves by looking at Debug build or sing le iteration bench times! |
| 655 continue; | 655 continue; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 677 gContextFactory.destroyContexts(); | 677 gContextFactory.destroyContexts(); |
| 678 #endif | 678 #endif |
| 679 return 0; | 679 return 0; |
| 680 } | 680 } |
| 681 | 681 |
| 682 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 682 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 683 int main(int argc, char * const argv[]) { | 683 int main(int argc, char * const argv[]) { |
| 684 return tool_main(argc, (char**) argv); | 684 return tool_main(argc, (char**) argv); |
| 685 } | 685 } |
| 686 #endif | 686 #endif |
| OLD | NEW |