| 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 "BenchLogger.h" |
| 9 #include "BenchTimer.h" | |
| 10 #include "Benchmark.h" | 9 #include "Benchmark.h" |
| 11 #include "CrashHandler.h" | 10 #include "CrashHandler.h" |
| 12 #include "GMBench.h" | 11 #include "GMBench.h" |
| 13 #include "ResultsWriter.h" | 12 #include "ResultsWriter.h" |
| 14 #include "SkBitmapDevice.h" | 13 #include "SkBitmapDevice.h" |
| 15 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 16 #include "SkColorPriv.h" | 15 #include "SkColorPriv.h" |
| 17 #include "SkCommandLineFlags.h" | 16 #include "SkCommandLineFlags.h" |
| 18 #include "SkData.h" | 17 #include "SkData.h" |
| 19 #include "SkDeferredCanvas.h" | 18 #include "SkDeferredCanvas.h" |
| 20 #include "SkGraphics.h" | 19 #include "SkGraphics.h" |
| 21 #include "SkImageEncoder.h" | 20 #include "SkImageEncoder.h" |
| 22 #include "SkOSFile.h" | 21 #include "SkOSFile.h" |
| 23 #include "SkPicture.h" | 22 #include "SkPicture.h" |
| 24 #include "SkPictureRecorder.h" | 23 #include "SkPictureRecorder.h" |
| 25 #include "SkString.h" | 24 #include "SkString.h" |
| 26 #include "SkSurface.h" | 25 #include "SkSurface.h" |
| 26 #include "Timer.h" |
| 27 | 27 |
| 28 #if SK_SUPPORT_GPU | 28 #if SK_SUPPORT_GPU |
| 29 #include "GrContext.h" | 29 #include "GrContext.h" |
| 30 #include "GrContextFactory.h" | 30 #include "GrContextFactory.h" |
| 31 #include "GrRenderTarget.h" | 31 #include "GrRenderTarget.h" |
| 32 #include "SkGpuDevice.h" | 32 #include "SkGpuDevice.h" |
| 33 #include "gl/GrGLDefines.h" | 33 #include "gl/GrGLDefines.h" |
| 34 #else | 34 #else |
| 35 class GrContext; | 35 class GrContext; |
| 36 #endif // SK_SUPPORT_GPU | 36 #endif // SK_SUPPORT_GPU |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (Benchmark::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 Timer timer(contextHelper); |
| 534 #else | 534 #else |
| 535 BenchTimer timer; | 535 Timer 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 |
| 541 // variables used to compute loopsPerFrame | 541 // variables used to compute loopsPerFrame |
| 542 double frameIntervalTime = 0.0f; | 542 double frameIntervalTime = 0.0f; |
| 543 int frameIntervalTotalLoops = 0; | 543 int frameIntervalTotalLoops = 0; |
| 544 | 544 |
| 545 bool frameIntervalComputed = false; | 545 bool frameIntervalComputed = false; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |