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 "nanobench.h" | 10 #include "nanobench.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); | 92 DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str()); |
93 | 93 |
94 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); | 94 DEFINE_int32(samples, 10, "Number of samples to measure for each bench."); |
95 DEFINE_int32(ms, 0, "If >0, run each bench for this many ms instead of obeying -
-samples."); | 95 DEFINE_int32(ms, 0, "If >0, run each bench for this many ms instead of obeying -
-samples."); |
96 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); | 96 DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead."); |
97 DEFINE_double(overheadGoal, 0.0001, | 97 DEFINE_double(overheadGoal, 0.0001, |
98 "Loop until timer overhead is at most this fraction of our measurm
ents."); | 98 "Loop until timer overhead is at most this fraction of our measurm
ents."); |
99 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); | 99 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); |
100 DEFINE_int32(gpuFrameLag, 5, "If unknown, estimated maximum number of frames GPU
allows to lag."); | 100 DEFINE_int32(gpuFrameLag, 5, "If unknown, estimated maximum number of frames GPU
allows to lag."); |
101 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
back to " | |
102 "software path rendering."); | |
103 | 101 |
104 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 102 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
105 DEFINE_int32(maxCalibrationAttempts, 3, | 103 DEFINE_int32(maxCalibrationAttempts, 3, |
106 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 104 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
107 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 105 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |
108 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 106 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |
109 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 107 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |
110 DEFINE_string(zoom, "1.0,0", "Comma-separated zoomMax,zoomPeriodMs factors for a
periodic SKP zoom " | 108 DEFINE_string(zoom, "1.0,0", "Comma-separated zoomMax,zoomPeriodMs factors for a
periodic SKP zoom " |
111 "function that ping-pongs between 1.0 and zoomMax."
); | 109 "function that ping-pongs between 1.0 and zoomMax."
); |
112 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); | 110 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 } | 1027 } |
1030 | 1028 |
1031 int nanobench_main(); | 1029 int nanobench_main(); |
1032 int nanobench_main() { | 1030 int nanobench_main() { |
1033 SetupCrashHandler(); | 1031 SetupCrashHandler(); |
1034 SkAutoGraphics ag; | 1032 SkAutoGraphics ag; |
1035 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1033 SkTaskGroup::Enabler enabled(FLAGS_threads); |
1036 | 1034 |
1037 #if SK_SUPPORT_GPU | 1035 #if SK_SUPPORT_GPU |
1038 GrContextOptions grContextOpts; | 1036 GrContextOptions grContextOpts; |
1039 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; | |
1040 gGrFactory.reset(new GrContextFactory(grContextOpts)); | 1037 gGrFactory.reset(new GrContextFactory(grContextOpts)); |
1041 #endif | 1038 #endif |
1042 | 1039 |
1043 if (FLAGS_veryVerbose) { | 1040 if (FLAGS_veryVerbose) { |
1044 FLAGS_verbose = true; | 1041 FLAGS_verbose = true; |
1045 } | 1042 } |
1046 | 1043 |
1047 if (kAutoTuneLoops != FLAGS_loops) { | 1044 if (kAutoTuneLoops != FLAGS_loops) { |
1048 FLAGS_samples = 1; | 1045 FLAGS_samples = 1; |
1049 FLAGS_gpuFrameLag = 0; | 1046 FLAGS_gpuFrameLag = 0; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 | 1283 |
1287 return 0; | 1284 return 0; |
1288 } | 1285 } |
1289 | 1286 |
1290 #if !defined SK_BUILD_FOR_IOS | 1287 #if !defined SK_BUILD_FOR_IOS |
1291 int main(int argc, char** argv) { | 1288 int main(int argc, char** argv) { |
1292 SkCommandLineFlags::Parse(argc, argv); | 1289 SkCommandLineFlags::Parse(argc, argv); |
1293 return nanobench_main(); | 1290 return nanobench_main(); |
1294 } | 1291 } |
1295 #endif | 1292 #endif |
OLD | NEW |