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 15 matching lines...) Expand all Loading... |
26 #if SK_SUPPORT_GPU | 26 #if SK_SUPPORT_GPU |
27 #include "gl/GrGLDefines.h" | 27 #include "gl/GrGLDefines.h" |
28 #include "GrContextFactory.h" | 28 #include "GrContextFactory.h" |
29 GrContextFactory gGrFactory; | 29 GrContextFactory gGrFactory; |
30 #endif | 30 #endif |
31 | 31 |
32 __SK_FORCE_IMAGE_DECODER_LINKING; | 32 __SK_FORCE_IMAGE_DECODER_LINKING; |
33 | 33 |
34 static const int kAutoTuneLoops = -1; | 34 static const int kAutoTuneLoops = -1; |
35 | 35 |
36 static const int kDefaultLoops = | 36 static const int kDefaultLoops = |
37 #ifdef SK_DEBUG | 37 #ifdef SK_DEBUG |
38 1; | 38 1; |
39 #else | 39 #else |
40 kAutoTuneLoops; | 40 kAutoTuneLoops; |
41 #endif | 41 #endif |
42 | 42 |
43 static SkString loops_help_txt() { | 43 static SkString loops_help_txt() { |
44 SkString help; | 44 SkString help; |
45 help.printf("Number of times to run each bench. Set this to %d to auto-" | 45 help.printf("Number of times to run each bench. Set this to %d to auto-" |
46 "tune for each bench. Timings are only reported when auto-tuning
.", | 46 "tune for each bench. Timings are only reported when auto-tuning
.", |
47 kAutoTuneLoops); | 47 kAutoTuneLoops); |
48 return help; | 48 return help; |
49 } | 49 } |
50 | 50 |
51 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); | 51 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); |
52 | 52 |
53 DEFINE_string2(writePath, w, "", "If set, write benches here as .pngs."); | |
54 | |
55 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); | 53 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); |
56 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); | 54 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); |
57 DEFINE_double(overheadGoal, 0.0001, | 55 DEFINE_double(overheadGoal, 0.0001, |
58 "Loop until timer overhead is at most this fraction of our measurm
ents."); | 56 "Loop until timer overhead is at most this fraction of our measurm
ents."); |
59 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); | 57 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); |
60 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); | 58 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); |
61 | 59 |
62 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 60 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
63 DEFINE_int32(maxCalibrationAttempts, 3, | 61 DEFINE_int32(maxCalibrationAttempts, 3, |
64 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 62 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 681 |
684 return 0; | 682 return 0; |
685 } | 683 } |
686 | 684 |
687 #if !defined SK_BUILD_FOR_IOS | 685 #if !defined SK_BUILD_FOR_IOS |
688 int main(int argc, char** argv) { | 686 int main(int argc, char** argv) { |
689 SkCommandLineFlags::Parse(argc, argv); | 687 SkCommandLineFlags::Parse(argc, argv); |
690 return nanobench_main(); | 688 return nanobench_main(); |
691 } | 689 } |
692 #endif | 690 #endif |
OLD | NEW |