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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
9 #include "ResultsWriter.h" | 9 #include "ResultsWriter.h" |
10 #include "SkBenchLogger.h" | 10 #include "SkBenchLogger.h" |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // you've got a computer clocked at several THz or have a br
oken benchmark. ;) | 596 // you've got a computer clocked at several THz or have a br
oken benchmark. ;) |
597 // "1B ought to be enough for anybody." | 597 // "1B ought to be enough for anybody." |
598 logger.logError(SkStringPrintf( | 598 logger.logError(SkStringPrintf( |
599 "\nCan't get %s %s to converge in %dms (%d loops)", | 599 "\nCan't get %s %s to converge in %dms (%d loops)", |
600 bench->getName(), config.name, FLAGS_maxMs, loopsPerIte
r)); | 600 bench->getName(), config.name, FLAGS_maxMs, loopsPerIte
r)); |
601 break; | 601 break; |
602 } | 602 } |
603 | 603 |
604 if ((benchMode == kRecord_BenchMode || benchMode == kPictureReco
rd_BenchMode)) { | 604 if ((benchMode == kRecord_BenchMode || benchMode == kPictureReco
rd_BenchMode)) { |
605 // Clear the recorded commands so that they do not accumulat
e. | 605 // Clear the recorded commands so that they do not accumulat
e. |
606 canvas.reset(recordTo.beginRecording(dim.fX, dim.fY, kRecord
Flags)); | 606 canvas.reset(SkRef(recordTo.beginRecording(dim.fX, dim.fY, k
RecordFlags))); |
607 } | 607 } |
608 | 608 |
609 timer.start(); | 609 timer.start(); |
610 // Inner loop that allows us to break the run into smaller | 610 // Inner loop that allows us to break the run into smaller |
611 // chunks (e.g. frames). This is especially useful for the GPU | 611 // chunks (e.g. frames). This is especially useful for the GPU |
612 // as we can flush and/or swap buffers to keep the GPU from | 612 // as we can flush and/or swap buffers to keep the GPU from |
613 // queuing up too much work. | 613 // queuing up too much work. |
614 for (int loopCount = loopsPerIter; loopCount > 0; ) { | 614 for (int loopCount = loopsPerIter; loopCount > 0; ) { |
615 // Save and restore around each call to draw() to guarantee
a pristine canvas. | 615 // Save and restore around each call to draw() to guarantee
a pristine canvas. |
616 SkAutoCanvasRestore saveRestore(canvas, true/*also save*/); | 616 SkAutoCanvasRestore saveRestore(canvas, true/*also save*/); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 gContextFactory.destroyContexts(); | 717 gContextFactory.destroyContexts(); |
718 #endif | 718 #endif |
719 return 0; | 719 return 0; |
720 } | 720 } |
721 | 721 |
722 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 722 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
723 int main(int argc, char * const argv[]) { | 723 int main(int argc, char * const argv[]) { |
724 return tool_main(argc, (char**) argv); | 724 return tool_main(argc, (char**) argv); |
725 } | 725 } |
726 #endif | 726 #endif |
OLD | NEW |