| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // Stop truncated timers before GL calls complete, and stop the
full timers after. | 639 // Stop truncated timers before GL calls complete, and stop the
full timers after. |
| 640 timer.truncatedEnd(); | 640 timer.truncatedEnd(); |
| 641 #if SK_SUPPORT_GPU | 641 #if SK_SUPPORT_GPU |
| 642 if (NULL != glContext) { | 642 if (NULL != glContext) { |
| 643 context->flush(); | 643 context->flush(); |
| 644 SK_GL(*glContext, Finish()); | 644 SK_GL(*glContext, Finish()); |
| 645 } | 645 } |
| 646 #endif | 646 #endif |
| 647 timer.end(); | 647 timer.end(); |
| 648 | 648 |
| 649 #if SK_SUPPORT_GPU | 649 // setup the frame interval for subsequent iterations |
| 650 // currently we only setup the frame interval for the GPU | 650 if (!frameIntervalComputed) { |
| 651 if (!frameIntervalComputed && NULL != glContext) { | |
| 652 frameIntervalTime += timer.fWall; | 651 frameIntervalTime += timer.fWall; |
| 653 frameIntervalTotalLoops += loopsPerIter; | 652 frameIntervalTotalLoops += loopsPerIter; |
| 654 if (frameIntervalTime >= FLAGS_minMs) { | 653 if (frameIntervalTime >= FLAGS_minMs) { |
| 655 frameIntervalComputed = true; | 654 frameIntervalComputed = true; |
| 656 loopsPerFrame = | 655 loopsPerFrame = |
| 657 (int)(((double)frameIntervalTotalLoops / frameInterval
Time) * FLAGS_minMs); | 656 (int)(((double)frameIntervalTotalLoops / frameInterval
Time) * FLAGS_minMs); |
| 658 if (loopsPerFrame < 1) { | 657 if (loopsPerFrame < 1) { |
| 659 loopsPerFrame = 1; | 658 loopsPerFrame = 1; |
| 660 } | 659 } |
| 661 // SkDebugf(" %s has %d loops in %f ms (normalized to %d
)\n", | 660 // SkDebugf(" %s has %d loops in %f ms (normalized to %d
)\n", |
| 662 // bench->getName(), frameIntervalTotalLoops, | 661 // bench->getName(), frameIntervalTotalLoops, |
| 663 // timer.fWall, loopsPerFrame); | 662 // timer.fWall, loopsPerFrame); |
| 664 } | 663 } |
| 665 } | 664 } |
| 666 #endif | 665 |
| 667 const double current = timer.fWall / loopsPerIter; | 666 const double current = timer.fWall / loopsPerIter; |
| 668 if (FLAGS_verbose && current > previous) { SkDebugf("↑"); } | 667 if (FLAGS_verbose && current > previous) { SkDebugf("↑"); } |
| 669 if (FLAGS_verbose) { SkDebugf("%.3g ", current); } | 668 if (FLAGS_verbose) { SkDebugf("%.3g ", current); } |
| 670 converged = HasConverged(previous, current, timer.fWall); | 669 converged = HasConverged(previous, current, timer.fWall); |
| 671 previous = current; | 670 previous = current; |
| 672 } while (!kIsDebug && !converged); | 671 } while (!kIsDebug && !converged); |
| 673 if (FLAGS_verbose) { SkDebugf("\n"); } | 672 if (FLAGS_verbose) { SkDebugf("\n"); } |
| 674 | 673 |
| 675 if (FLAGS_outDir.count() && kNonRendering_Backend != config.backend)
{ | 674 if (FLAGS_outDir.count() && kNonRendering_Backend != config.backend)
{ |
| 676 saveFile(bench->getName(), | 675 saveFile(bench->getName(), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 gContextFactory.destroyContexts(); | 711 gContextFactory.destroyContexts(); |
| 713 #endif | 712 #endif |
| 714 return 0; | 713 return 0; |
| 715 } | 714 } |
| 716 | 715 |
| 717 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 716 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 718 int main(int argc, char * const argv[]) { | 717 int main(int argc, char * const argv[]) { |
| 719 return tool_main(argc, (char**) argv); | 718 return tool_main(argc, (char**) argv); |
| 720 } | 719 } |
| 721 #endif | 720 #endif |
| OLD | NEW |