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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
15 #include "SkRecording.h" | 15 #include "SkRecording.h" |
16 #include "SkStream.h" | 16 #include "SkStream.h" |
17 #include "SkString.h" | 17 #include "SkString.h" |
18 #include "LazyDecodeBitmap.h" | 18 #include "LazyDecodeBitmap.h" |
19 | 19 |
20 __SK_FORCE_IMAGE_DECODER_LINKING; | 20 __SK_FORCE_IMAGE_DECODER_LINKING; |
21 | 21 |
22 // Just reading all the SKPs takes about 2 seconds for me, which is the same as
about 100 loops of | 22 // Just reading all the SKPs takes about 2 seconds for me, which is the same as
about 100 loops of |
23 // rerecording all the SKPs. So we default to --loops=900, which makes ~90% of
our time spent in | 23 // rerecording all the SKPs. So we default to --loops=900, which makes ~90% of
our time spent in |
24 // recording, and this should take ~20 seconds to run. | 24 // recording, and this should take ~20 seconds to run. |
25 | 25 |
26 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record
."); | 26 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record
."); |
27 DEFINE_int32(loops, 900, "Number of times to re-record each SKP."); | 27 DEFINE_int32(loops, 900, "Number of times to re-record each SKP."); |
28 DEFINE_int32(flags, SkPicture::kUsePathBoundsForClip_RecordingFlag, "RecordingFl
ags to use."); | 28 DEFINE_int32(flags, 0, "RecordingFlags to use."); |
29 DEFINE_bool(endRecording, true, "If false, don't time SkPicture::endRecording()"
); | 29 DEFINE_bool(endRecording, true, "If false, don't time SkPicture::endRecording()"
); |
30 DEFINE_int32(nullSize, 1000, "Pretend dimension of null source picture."); | 30 DEFINE_int32(nullSize, 1000, "Pretend dimension of null source picture."); |
31 DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
not set to tilegrid."); | 31 DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
not set to tilegrid."); |
32 DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tileg
rid, quadtree"); | 32 DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tileg
rid, quadtree"); |
33 DEFINE_bool(skr, false, "Record SKR instead of SKP."); | 33 DEFINE_bool(skr, false, "Record SKR instead of SKP."); |
34 DEFINE_string(match, "", "The usual filters on file names of SKPs to bench."); | 34 DEFINE_string(match, "", "The usual filters on file names of SKPs to bench."); |
35 DEFINE_string(timescale, "us", "Print times in ms, us, or ns"); | 35 DEFINE_string(timescale, "us", "Print times in ms, us, or ns"); |
36 | 36 |
37 static double scale_time(double ms) { | 37 static double scale_time(double ms) { |
38 if (FLAGS_timescale.contains("us")) ms *= 1000; | 38 if (FLAGS_timescale.contains("us")) ms *= 1000; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bench_record(src, filename.c_str(), bbhFactory.get()); | 135 bench_record(src, filename.c_str(), bbhFactory.get()); |
136 } | 136 } |
137 return failed ? 1 : 0; | 137 return failed ? 1 : 0; |
138 } | 138 } |
139 | 139 |
140 #if !defined SK_BUILD_FOR_IOS | 140 #if !defined SK_BUILD_FOR_IOS |
141 int main(int argc, char * const argv[]) { | 141 int main(int argc, char * const argv[]) { |
142 return tool_main(argc, (char**) argv); | 142 return tool_main(argc, (char**) argv); |
143 } | 143 } |
144 #endif | 144 #endif |
OLD | NEW |