blob: 8edbb9423ccc0d4a3870c53880337f3908f2a933 [file] [log] [blame]
reed@google.com006db0f2012-06-27 19:33:29 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "BenchTimer.h"
keyar@chromium.org163b5672012-08-01 17:53:29 +00009#include "PictureBenchmark.h"
scroggo@google.com9a412522012-09-07 15:21:18 +000010#include "SkBenchLogger.h"
reed@google.com006db0f2012-06-27 19:33:29 +000011#include "SkCanvas.h"
scroggo@google.com0a36f432012-09-10 20:29:13 +000012#include "SkGraphics.h"
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +000013#include "SkMath.h"
reed@google.com006db0f2012-06-27 19:33:29 +000014#include "SkOSFile.h"
15#include "SkPicture.h"
16#include "SkStream.h"
17#include "SkTArray.h"
18#include "picture_utils.h"
19
20const int DEFAULT_REPEATS = 100;
reed@google.com006db0f2012-06-27 19:33:29 +000021
22static void usage(const char* argv0) {
23 SkDebugf("SkPicture benchmarking tool\n");
24 SkDebugf("\n"
25"Usage: \n"
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +000026" %s <inputDir>...\n"
scroggo@google.com5239c322012-09-11 19:15:32 +000027" [--logFile filename][--timers [wcgWC]*][--logPerIter 1|0][--min]\n"
keyar@chromium.org795cd472012-08-02 18:57:53 +000028" [--repeat] \n"
scroggo@google.com58b4ead2012-08-31 16:15:22 +000029" [--mode pow2tile minWidth height[] (multi) | record | simple\n"
scroggo@google.com9a412522012-09-07 15:21:18 +000030" | tile width[] height[] (multi) | playbackCreation]\n"
scroggo@google.com58b4ead2012-08-31 16:15:22 +000031" [--pipe]\n"
keyar@chromium.orgc81686c2012-08-20 15:04:04 +000032" [--device bitmap"
33#if SK_SUPPORT_GPU
34" | gpu"
35#endif
36"]"
reed@google.com006db0f2012-06-27 19:33:29 +000037, argv0);
38 SkDebugf("\n\n");
39 SkDebugf(
keyar@chromium.org795cd472012-08-02 18:57:53 +000040" inputDir: A list of directories and files to use as input. Files are\n"
scroggo@google.com9a412522012-09-07 15:21:18 +000041" expected to have the .skp extension.\n\n"
42" --logFile filename : destination for writing log output, in addition to stdout.\n");
scroggo@google.com5239c322012-09-11 19:15:32 +000043 SkDebugf(" --logPerIter 1|0 : "
44 "Log each repeat timer instead of mean, default is disabled.\n");
45 SkDebugf(" --min : Print the minimum times (instead of average).\n");
46 SkDebugf(" --timers [wcgWC]* : "
47 "Display wall, cpu, gpu, truncated wall or truncated cpu time for each picture.\n");
reed@google.com006db0f2012-06-27 19:33:29 +000048 SkDebugf(
scroggo@google.com58b4ead2012-08-31 16:15:22 +000049" --mode pow2tile minWidht height[] (multi) | record | simple\n"
scroggo@google.com9a412522012-09-07 15:21:18 +000050" | tile width[] height[] (multi) | playbackCreation:\n"
scroggo@google.com58b4ead2012-08-31 16:15:22 +000051" Run in the corresponding mode.\n"
52" Default is simple.\n");
keyar@chromium.orgcf6c44c2012-07-09 19:37:40 +000053 SkDebugf(
scroggo@google.com58b4ead2012-08-31 16:15:22 +000054" pow2tile minWidth height[], Creates tiles with widths\n"
55" that are all a power of two\n"
56" such that they minimize the\n"
57" amount of wasted tile space.\n"
58" minWidth is the minimum width\n"
59" of these tiles and must be a\n"
60" power of two. Simple\n"
61" rendering using these tiles\n"
62" is benchmarked.\n"
63" Append \"multi\" for multithreaded\n"
64" drawing.\n");
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +000065 SkDebugf(
keyar@chromium.org795cd472012-08-02 18:57:53 +000066" record, Benchmark picture to picture recording.\n");
67 SkDebugf(
68" simple, Benchmark a simple rendering.\n");
69 SkDebugf(
scroggo@google.com58b4ead2012-08-31 16:15:22 +000070" tile width[] height[], Benchmark simple rendering using\n"
71" tiles with the given dimensions.\n"
72" Append \"multi\" for multithreaded\n"
73" drawing.\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +000074 SkDebugf(
scroggo@google.com9a412522012-09-07 15:21:18 +000075" playbackCreation, Benchmark creation of the SkPicturePlayback.\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +000076 SkDebugf("\n");
77 SkDebugf(
scroggo@google.com58b4ead2012-08-31 16:15:22 +000078" --pipe: Benchmark SkGPipe rendering. Compatible with tiled, multithreaded rendering.\n");
79 SkDebugf(
keyar@chromium.orgc81686c2012-08-20 15:04:04 +000080" --device bitmap"
81#if SK_SUPPORT_GPU
82" | gpu"
83#endif
84": Use the corresponding device. Default is bitmap.\n");
85 SkDebugf(
86" bitmap, Render to a bitmap.\n");
keyar@chromium.orgc81686c2012-08-20 15:04:04 +000087#if SK_SUPPORT_GPU
keyar@chromium.orga40c20d2012-08-20 15:04:12 +000088 SkDebugf(
keyar@chromium.orgc81686c2012-08-20 15:04:04 +000089" gpu, Render to the GPU.\n");
90#endif
91 SkDebugf("\n");
92 SkDebugf(
keyar@chromium.org795cd472012-08-02 18:57:53 +000093" --repeat: "
reed@google.com006db0f2012-06-27 19:33:29 +000094"Set the number of times to repeat each test."
95" Default is %i.\n", DEFAULT_REPEATS);
reed@google.com006db0f2012-06-27 19:33:29 +000096}
97
scroggo@google.com9a412522012-09-07 15:21:18 +000098SkBenchLogger gLogger;
99
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000100static void run_single_benchmark(const SkString& inputPath,
keyar@chromium.org163b5672012-08-01 17:53:29 +0000101 sk_tools::PictureBenchmark& benchmark) {
reed@google.com006db0f2012-06-27 19:33:29 +0000102 SkFILEStream inputStream;
103
reed@google.com006db0f2012-06-27 19:33:29 +0000104 inputStream.setPath(inputPath.c_str());
105 if (!inputStream.isValid()) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000106 SkString err;
107 err.printf("Could not open file %s\n", inputPath.c_str());
108 gLogger.logError(err);
reed@google.com006db0f2012-06-27 19:33:29 +0000109 return;
110 }
111
112 SkPicture picture(&inputStream);
reed@google.com006db0f2012-06-27 19:33:29 +0000113
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000114 SkString filename;
115 sk_tools::get_basename(&filename, inputPath);
keyar@chromium.orgdb9a5fb2012-08-21 17:57:59 +0000116
117 SkString result;
118 result.printf("running bench [%i %i] %s ", picture.width(), picture.height(),
119 filename.c_str());
scroggo@google.com9a412522012-09-07 15:21:18 +0000120 gLogger.logProgress(result);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000121
keyar@chromium.org163b5672012-08-01 17:53:29 +0000122 benchmark.run(&picture);
keyar@chromium.org0665f252012-07-10 18:30:18 +0000123}
124
keyar@chromium.org163b5672012-08-01 17:53:29 +0000125static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,
scroggo@google.com5239c322012-09-11 19:15:32 +0000126 sk_tools::PictureBenchmark* benchmark) {
reed@google.com006db0f2012-06-27 19:33:29 +0000127 const char* argv0 = argv[0];
128 char* const* stop = argv + argc;
129
keyar@chromium.org163b5672012-08-01 17:53:29 +0000130 int repeats = DEFAULT_REPEATS;
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000131 sk_tools::PictureRenderer::SkDeviceTypes deviceType =
132 sk_tools::PictureRenderer::kBitmap_DeviceType;
keyar@chromium.org163b5672012-08-01 17:53:29 +0000133
scroggo@google.com5239c322012-09-11 19:15:32 +0000134 sk_tools::PictureRenderer* renderer = NULL;
135
scroggo@google.com9a412522012-09-07 15:21:18 +0000136 // Create a string to show our current settings.
137 // TODO: Make it prettier. Currently it just repeats the command line.
138 SkString commandLine("bench_pictures:");
139 for (int i = 1; i < argc; i++) {
140 commandLine.appendf(" %s", *(argv+i));
141 }
142 commandLine.append("\n");
143
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000144 bool usePipe = false;
145 bool multiThreaded = false;
146 bool useTiles = false;
147 const char* widthString = NULL;
148 const char* heightString = NULL;
149 bool isPowerOf2Mode = false;
150 const char* mode = NULL;
reed@google.com006db0f2012-06-27 19:33:29 +0000151 for (++argv; argv < stop; ++argv) {
152 if (0 == strcmp(*argv, "--repeat")) {
153 ++argv;
154 if (argv < stop) {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000155 repeats = atoi(*argv);
156 if (repeats < 1) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000157 gLogger.logError("--repeat must be given a value > 0\n");
reed@google.com006db0f2012-06-27 19:33:29 +0000158 exit(-1);
159 }
160 } else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000161 gLogger.logError("Missing arg for --repeat\n");
reed@google.com006db0f2012-06-27 19:33:29 +0000162 usage(argv0);
163 exit(-1);
164 }
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000165 } else if (0 == strcmp(*argv, "--pipe")) {
166 usePipe = true;
scroggo@google.com9a412522012-09-07 15:21:18 +0000167 } else if (0 == strcmp(*argv, "--logFile")) {
168 argv++;
169 if (argv < stop) {
170 if (!gLogger.SetLogFile(*argv)) {
171 SkString str;
172 str.printf("Could not open %s for writing.", *argv);
173 gLogger.logError(str);
174 usage(argv0);
borenet@google.coma49bffd2012-09-13 18:54:48 +0000175 // TODO(borenet): We're disabling this for now, due to
176 // write-protected Android devices. The very short-term
177 // solution is to ignore the fact that we have no log file.
178 //exit(-1);
scroggo@google.com9a412522012-09-07 15:21:18 +0000179 }
180 } else {
181 gLogger.logError("Missing arg for --logFile\n");
182 usage(argv0);
183 exit(-1);
184 }
keyar@chromium.org795cd472012-08-02 18:57:53 +0000185 } else if (0 == strcmp(*argv, "--mode")) {
keyar@chromium.org795cd472012-08-02 18:57:53 +0000186
reed@google.com006db0f2012-06-27 19:33:29 +0000187 ++argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000188 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000189 gLogger.logError("Missing mode for --mode\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +0000190 usage(argv0);
191 exit(-1);
192 }
193
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000194 if (0 == strcmp(*argv, "record")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000195 renderer = SkNEW(sk_tools::RecordPictureRenderer);
keyar@chromium.org795cd472012-08-02 18:57:53 +0000196 } else if (0 == strcmp(*argv, "simple")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000197 renderer = SkNEW(sk_tools::SimplePictureRenderer);
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000198 } else if ((0 == strcmp(*argv, "tile")) || (0 == strcmp(*argv, "pow2tile"))) {
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000199 useTiles = true;
200 mode = *argv;
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000201
202 if (0 == strcmp(*argv, "pow2tile")) {
203 isPowerOf2Mode = true;
204 }
205
keyar@chromium.org795cd472012-08-02 18:57:53 +0000206 ++argv;
207 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000208 SkString err;
209 err.printf("Missing width for --mode %s\n", mode);
210 gLogger.logError(err);
keyar@chromium.org795cd472012-08-02 18:57:53 +0000211 usage(argv0);
212 exit(-1);
213 }
214
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000215 widthString = *argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000216 ++argv;
217 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000218 gLogger.logError("Missing height for --mode tile\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +0000219 usage(argv0);
220 exit(-1);
221 }
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000222 heightString = *argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000223
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000224 ++argv;
225 if (argv < stop && 0 == strcmp(*argv, "multi")) {
226 multiThreaded = true;
keyar@chromium.org0665f252012-07-10 18:30:18 +0000227 } else {
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000228 --argv;
reed@google.com006db0f2012-06-27 19:33:29 +0000229 }
scroggo@google.com9a412522012-09-07 15:21:18 +0000230 } else if (0 == strcmp(*argv, "playbackCreation")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000231 renderer = SkNEW(sk_tools::PlaybackCreationRenderer);
reed@google.com006db0f2012-06-27 19:33:29 +0000232 } else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000233 SkString err;
234 err.printf("%s is not a valid mode for --mode\n", *argv);
235 gLogger.logError(err);
keyar@chromium.org0665f252012-07-10 18:30:18 +0000236 usage(argv0);
reed@google.com006db0f2012-06-27 19:33:29 +0000237 exit(-1);
238 }
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000239 } else if (0 == strcmp(*argv, "--device")) {
240 ++argv;
241 if (argv >= stop) {
borenet@google.coma49bffd2012-09-13 18:54:48 +0000242 gLogger.logError("Missing mode for --device\n");
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000243 usage(argv0);
244 exit(-1);
245 }
246
247 if (0 == strcmp(*argv, "bitmap")) {
248 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
249 }
250#if SK_SUPPORT_GPU
251 else if (0 == strcmp(*argv, "gpu")) {
252 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
253 }
254#endif
255 else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000256 SkString err;
257 err.printf("%s is not a valid mode for --device\n", *argv);
258 gLogger.logError(err);
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000259 usage(argv0);
260 exit(-1);
261 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000262 } else if (0 == strcmp(*argv, "--timers")) {
263 ++argv;
264 if (argv < stop) {
265 bool timerWall = false;
266 bool truncatedTimerWall = false;
267 bool timerCpu = false;
268 bool truncatedTimerCpu = false;
269 bool timerGpu = false;
270 for (char* t = *argv; *t; ++t) {
271 switch (*t) {
272 case 'w':
273 timerWall = true;
274 break;
275 case 'c':
276 timerCpu = true;
277 break;
278 case 'W':
279 truncatedTimerWall = true;
280 break;
281 case 'C':
282 truncatedTimerCpu = true;
283 break;
284 case 'g':
285 timerGpu = true;
286 break;
287 default: {
288 break;
289 }
290 }
291 }
292 benchmark->setTimersToShow(timerWall, truncatedTimerWall, timerCpu,
293 truncatedTimerCpu, timerGpu);
294 } else {
295 gLogger.logError("Missing arg for --timers\n");
296 usage(argv0);
297 exit(-1);
298 }
299 } else if (0 == strcmp(*argv, "--min")) {
300 benchmark->setPrintMin(true);
301 } else if (0 == strcmp(*argv, "--logPerIter")) {
302 ++argv;
303 if (argv < stop) {
304 bool log = atoi(*argv) != 0;
305 benchmark->setLogPerIter(log);
306 } else {
307 gLogger.logError("Missing arg for --logPerIter\n");
308 usage(argv0);
309 exit(-1);
310 }
reed@google.com006db0f2012-06-27 19:33:29 +0000311 } else if (0 == strcmp(*argv, "--help") || 0 == strcmp(*argv, "-h")) {
312 usage(argv0);
313 exit(0);
314 } else {
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000315 inputs->push_back(SkString(*argv));
reed@google.com006db0f2012-06-27 19:33:29 +0000316 }
317 }
318
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000319 if (useTiles) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000320 SkASSERT(NULL == renderer);
321 sk_tools::TiledPictureRenderer* tiledRenderer = SkNEW(sk_tools::TiledPictureRenderer);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000322 if (isPowerOf2Mode) {
323 int minWidth = atoi(widthString);
324 if (!SkIsPow2(minWidth) || minWidth < 0) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000325 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000326 SkString err;
scroggo@google.com5239c322012-09-11 19:15:32 +0000327 err.printf("-mode %s must be given a width"
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000328 " value that is a power of two\n", mode);
scroggo@google.com9a412522012-09-07 15:21:18 +0000329 gLogger.logError(err);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000330 exit(-1);
331 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000332 tiledRenderer->setTileMinPowerOf2Width(minWidth);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000333 } else if (sk_tools::is_percentage(widthString)) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000334 tiledRenderer->setTileWidthPercentage(atof(widthString));
335 if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
336 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000337 gLogger.logError("--mode tile must be given a width percentage > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000338 exit(-1);
339 }
340 } else {
scroggo@google.com5239c322012-09-11 19:15:32 +0000341 tiledRenderer->setTileWidth(atoi(widthString));
342 if (!(tiledRenderer->getTileWidth() > 0)) {
343 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000344 gLogger.logError("--mode tile must be given a width > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000345 exit(-1);
346 }
347 }
348
349 if (sk_tools::is_percentage(heightString)) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000350 tiledRenderer->setTileHeightPercentage(atof(heightString));
351 if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
352 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000353 gLogger.logError("--mode tile must be given a height percentage > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000354 exit(-1);
355 }
356 } else {
scroggo@google.com5239c322012-09-11 19:15:32 +0000357 tiledRenderer->setTileHeight(atoi(heightString));
358 if (!(tiledRenderer->getTileHeight() > 0)) {
359 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000360 gLogger.logError("--mode tile must be given a height > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000361 exit(-1);
362 }
363 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000364 tiledRenderer->setMultiThreaded(multiThreaded);
365 tiledRenderer->setUsePipe(usePipe);
366 renderer = tiledRenderer;
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000367 } else if (usePipe) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000368 renderer = SkNEW(sk_tools::PipePictureRenderer);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000369 }
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000370 if (inputs->count() < 1) {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000371 SkDELETE(benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000372 usage(argv0);
373 exit(-1);
374 }
keyar@chromium.org163b5672012-08-01 17:53:29 +0000375
scroggo@google.com5239c322012-09-11 19:15:32 +0000376 if (NULL == renderer) {
377 renderer = SkNEW(sk_tools::SimplePictureRenderer);
keyar@chromium.org163b5672012-08-01 17:53:29 +0000378 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000379 benchmark->setRenderer(renderer)->unref();
keyar@chromium.org163b5672012-08-01 17:53:29 +0000380 benchmark->setRepeats(repeats);
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000381 benchmark->setDeviceType(deviceType);
scroggo@google.com9a412522012-09-07 15:21:18 +0000382 benchmark->setLogger(&gLogger);
383 // Report current settings:
384 gLogger.logProgress(commandLine);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000385}
reed@google.com006db0f2012-06-27 19:33:29 +0000386
keyar@chromium.org163b5672012-08-01 17:53:29 +0000387static void process_input(const SkString& input, sk_tools::PictureBenchmark& benchmark) {
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000388 SkOSFile::Iter iter(input.c_str(), "skp");
389 SkString inputFilename;
390
391 if (iter.next(&inputFilename)) {
392 do {
393 SkString inputPath;
keyar@chromium.org163b5672012-08-01 17:53:29 +0000394 sk_tools::make_filepath(&inputPath, input, inputFilename);
395 run_single_benchmark(inputPath, benchmark);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000396 } while(iter.next(&inputFilename));
397 } else {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000398 run_single_benchmark(input, benchmark);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000399 }
reed@google.com006db0f2012-06-27 19:33:29 +0000400}
401
402int main(int argc, char* const argv[]) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000403#ifdef SK_ENABLE_INST_COUNT
404 gPrintInstCount = true;
405#endif
scroggo@google.com0a36f432012-09-10 20:29:13 +0000406 SkAutoGraphics ag;
reed@google.com006db0f2012-06-27 19:33:29 +0000407
scroggo@google.com5239c322012-09-11 19:15:32 +0000408 SkTArray<SkString> inputs;
409 sk_tools::PictureBenchmark benchmark;
410
411 parse_commandline(argc, argv, &inputs, &benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000412
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000413 for (int i = 0; i < inputs.count(); ++i) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000414 process_input(inputs[i], benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000415 }
reed@google.com006db0f2012-06-27 19:33:29 +0000416}