OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 int nanobench_main() { | 569 int nanobench_main() { |
570 SetupCrashHandler(); | 570 SetupCrashHandler(); |
571 SkAutoGraphics ag; | 571 SkAutoGraphics ag; |
572 | 572 |
573 #if SK_SUPPORT_GPU | 573 #if SK_SUPPORT_GPU |
574 GrContext::Options grContextOpts; | 574 GrContext::Options grContextOpts; |
575 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; | 575 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; |
576 gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts))); | 576 gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts))); |
577 #endif | 577 #endif |
578 | 578 |
| 579 if (FLAGS_veryVerbose) { |
| 580 FLAGS_verbose = true; |
| 581 } |
| 582 |
579 if (kAutoTuneLoops != FLAGS_loops) { | 583 if (kAutoTuneLoops != FLAGS_loops) { |
580 FLAGS_samples = 1; | 584 FLAGS_samples = 1; |
581 FLAGS_gpuFrameLag = 0; | 585 FLAGS_gpuFrameLag = 0; |
582 } | 586 } |
583 | 587 |
584 if (!FLAGS_writePath.isEmpty()) { | 588 if (!FLAGS_writePath.isEmpty()) { |
585 SkDebugf("Writing files to %s.\n", FLAGS_writePath[0]); | 589 SkDebugf("Writing files to %s.\n", FLAGS_writePath[0]); |
586 if (!sk_mkdir(FLAGS_writePath[0])) { | 590 if (!sk_mkdir(FLAGS_writePath[0])) { |
587 SkDebugf("Could not create %s. Files won't be written.\n", FLAGS_wri
tePath[0]); | 591 SkDebugf("Could not create %s. Files won't be written.\n", FLAGS_wri
tePath[0]); |
588 FLAGS_writePath.set(0, NULL); | 592 FLAGS_writePath.set(0, NULL); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 , HUMANIZE(stats.min) | 716 , HUMANIZE(stats.min) |
713 , HUMANIZE(stats.median) | 717 , HUMANIZE(stats.median) |
714 , HUMANIZE(stats.mean) | 718 , HUMANIZE(stats.mean) |
715 , HUMANIZE(stats.max) | 719 , HUMANIZE(stats.max) |
716 , stddev_percent | 720 , stddev_percent |
717 , stats.plot.c_str() | 721 , stats.plot.c_str() |
718 , config | 722 , config |
719 , bench->getUniqueName() | 723 , bench->getUniqueName() |
720 ); | 724 ); |
721 } | 725 } |
| 726 #if SK_SUPPORT_GPU && GR_CACHE_STATS |
| 727 if (FLAGS_veryVerbose && |
| 728 Benchmark::kGPU_Backend == targets[j]->config.backend) { |
| 729 gGrFactory->get(targets[j]->config.ctxType)->printCacheStats();
|
| 730 } |
| 731 #endif |
722 } | 732 } |
723 targets.deleteAll(); | 733 targets.deleteAll(); |
724 | 734 |
725 #if SK_SUPPORT_GPU | 735 #if SK_SUPPORT_GPU |
726 if (FLAGS_abandonGpuContext) { | 736 if (FLAGS_abandonGpuContext) { |
727 gGrFactory->abandonContexts(); | 737 gGrFactory->abandonContexts(); |
728 } | 738 } |
729 if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) { | 739 if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) { |
730 gGrFactory->destroyContexts(); | 740 gGrFactory->destroyContexts(); |
731 } | 741 } |
732 #endif | 742 #endif |
733 } | 743 } |
734 | 744 |
735 return 0; | 745 return 0; |
736 } | 746 } |
737 | 747 |
738 #if !defined SK_BUILD_FOR_IOS | 748 #if !defined SK_BUILD_FOR_IOS |
739 int main(int argc, char** argv) { | 749 int main(int argc, char** argv) { |
740 SkCommandLineFlags::Parse(argc, argv); | 750 SkCommandLineFlags::Parse(argc, argv); |
741 return nanobench_main(); | 751 return nanobench_main(); |
742 } | 752 } |
743 #endif | 753 #endif |
OLD | NEW |