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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 68 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
69 DEFINE_int32(maxCalibrationAttempts, 3, | 69 DEFINE_int32(maxCalibrationAttempts, 3, |
70 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 70 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
71 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 71 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |
72 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 72 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |
73 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 73 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |
74 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); | 74 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); |
75 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?"); | 75 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?"); |
76 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); | 76 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); |
77 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test
."); | 77 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test
."); |
| 78 DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?"); |
78 | 79 |
79 static SkString humanize(double ms) { | 80 static SkString humanize(double ms) { |
80 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 81 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
81 return HumanizeMs(ms); | 82 return HumanizeMs(ms); |
82 } | 83 } |
83 #define HUMANIZE(ms) humanize(ms).c_str() | 84 #define HUMANIZE(ms) humanize(ms).c_str() |
84 | 85 |
85 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g
l) { | 86 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g
l) { |
86 if (canvas) { | 87 if (canvas) { |
87 canvas->clear(SK_ColorWHITE); | 88 canvas->clear(SK_ColorWHITE); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 , HUMANIZE(stats.min) | 760 , HUMANIZE(stats.min) |
760 , HUMANIZE(stats.median) | 761 , HUMANIZE(stats.median) |
761 , HUMANIZE(stats.mean) | 762 , HUMANIZE(stats.mean) |
762 , HUMANIZE(stats.max) | 763 , HUMANIZE(stats.max) |
763 , stddev_percent | 764 , stddev_percent |
764 , stats.plot.c_str() | 765 , stats.plot.c_str() |
765 , config | 766 , config |
766 , bench->getUniqueName() | 767 , bench->getUniqueName() |
767 ); | 768 ); |
768 } | 769 } |
769 #if SK_SUPPORT_GPU && GR_CACHE_STATS | 770 #if SK_SUPPORT_GPU |
770 if (FLAGS_veryVerbose && | 771 if (FLAGS_gpuStats && |
771 Benchmark::kGPU_Backend == targets[j]->config.backend) { | 772 Benchmark::kGPU_Backend == targets[j]->config.backend) { |
772 gGrFactory->get(targets[j]->config.ctxType)->printCacheStats(); | 773 gGrFactory->get(targets[j]->config.ctxType)->printCacheStats(); |
| 774 gGrFactory->get(targets[j]->config.ctxType)->printGpuStats(); |
773 } | 775 } |
774 #endif | 776 #endif |
775 } | 777 } |
776 targets.deleteAll(); | 778 targets.deleteAll(); |
777 | 779 |
778 #if SK_SUPPORT_GPU | 780 #if SK_SUPPORT_GPU |
779 if (FLAGS_abandonGpuContext) { | 781 if (FLAGS_abandonGpuContext) { |
780 gGrFactory->abandonContexts(); | 782 gGrFactory->abandonContexts(); |
781 } | 783 } |
782 if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) { | 784 if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) { |
783 gGrFactory->destroyContexts(); | 785 gGrFactory->destroyContexts(); |
784 } | 786 } |
785 #endif | 787 #endif |
786 } | 788 } |
787 | 789 |
788 log->bench("memory_usage", 0,0); | 790 log->bench("memory_usage", 0,0); |
789 log->config("meta"); | 791 log->config("meta"); |
790 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB()); | 792 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB()); |
791 | 793 |
792 return 0; | 794 return 0; |
793 } | 795 } |
794 | 796 |
795 #if !defined SK_BUILD_FOR_IOS | 797 #if !defined SK_BUILD_FOR_IOS |
796 int main(int argc, char** argv) { | 798 int main(int argc, char** argv) { |
797 SkCommandLineFlags::Parse(argc, argv); | 799 SkCommandLineFlags::Parse(argc, argv); |
798 return nanobench_main(); | 800 return nanobench_main(); |
799 } | 801 } |
800 #endif | 802 #endif |
OLD | NEW |