| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
| 67 DEFINE_int32(maxCalibrationAttempts, 3, | 67 DEFINE_int32(maxCalibrationAttempts, 3, |
| 68 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 68 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
| 69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |
| 70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |
| 71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |
| 72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); | 72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); |
| 73 | 73 |
| 74 static SkString humanize(double ms) { | 74 static SkString humanize(double ms) { |
| 75 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); | 75 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
| 76 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); | 76 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); |
| 77 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); |
| 77 #ifdef SK_BUILD_FOR_WIN | 78 #ifdef SK_BUILD_FOR_WIN |
| 78 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); | 79 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); |
| 79 #else | 80 #else |
| 80 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); | 81 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); |
| 81 #endif | 82 #endif |
| 82 return SkStringPrintf("%.3gms", ms); | 83 return SkStringPrintf("%.3gms", ms); |
| 83 } | 84 } |
| 84 #define HUMANIZE(ms) humanize(ms).c_str() | 85 #define HUMANIZE(ms) humanize(ms).c_str() |
| 85 | 86 |
| 86 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContextHel
per* gl) { | 87 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContextHel
per* gl) { |
| 87 if (canvas) { | 88 if (canvas) { |
| 88 canvas->clear(SK_ColorWHITE); | 89 canvas->clear(SK_ColorWHITE); |
| 89 } | 90 } |
| 90 WallTimer timer; | 91 WallTimer timer; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 717 |
| 717 return 0; | 718 return 0; |
| 718 } | 719 } |
| 719 | 720 |
| 720 #if !defined SK_BUILD_FOR_IOS | 721 #if !defined SK_BUILD_FOR_IOS |
| 721 int main(int argc, char** argv) { | 722 int main(int argc, char** argv) { |
| 722 SkCommandLineFlags::Parse(argc, argv); | 723 SkCommandLineFlags::Parse(argc, argv); |
| 723 return nanobench_main(); | 724 return nanobench_main(); |
| 724 } | 725 } |
| 725 #endif | 726 #endif |
| OLD | NEW |