blob: 93b1cf9646743dcdb21dab92f7cfd3c101bc2654 [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
borenet@google.come21795e2012-09-14 14:34:28 +0000112 SkPicture* picture = SkNEW_ARGS(SkPicture, (&inputStream));
113 SkAutoTUnref<SkPicture> aur(picture);
reed@google.com006db0f2012-06-27 19:33:29 +0000114
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000115 SkString filename;
116 sk_tools::get_basename(&filename, inputPath);
keyar@chromium.orgdb9a5fb2012-08-21 17:57:59 +0000117
118 SkString result;
borenet@google.come21795e2012-09-14 14:34:28 +0000119 result.printf("running bench [%i %i] %s ", picture->width(),
120 picture->height(), filename.c_str());
scroggo@google.com9a412522012-09-07 15:21:18 +0000121 gLogger.logProgress(result);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000122
borenet@google.come21795e2012-09-14 14:34:28 +0000123 // rescale to avoid memory issues allocating a very large offscreen
124 sk_tools::resize_if_needed(&aur);
125
126 benchmark.run(aur);
keyar@chromium.org0665f252012-07-10 18:30:18 +0000127}
128
keyar@chromium.org163b5672012-08-01 17:53:29 +0000129static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,
scroggo@google.com5239c322012-09-11 19:15:32 +0000130 sk_tools::PictureBenchmark* benchmark) {
reed@google.com006db0f2012-06-27 19:33:29 +0000131 const char* argv0 = argv[0];
132 char* const* stop = argv + argc;
133
keyar@chromium.org163b5672012-08-01 17:53:29 +0000134 int repeats = DEFAULT_REPEATS;
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000135 sk_tools::PictureRenderer::SkDeviceTypes deviceType =
136 sk_tools::PictureRenderer::kBitmap_DeviceType;
keyar@chromium.org163b5672012-08-01 17:53:29 +0000137
scroggo@google.com5239c322012-09-11 19:15:32 +0000138 sk_tools::PictureRenderer* renderer = NULL;
139
scroggo@google.com9a412522012-09-07 15:21:18 +0000140 // Create a string to show our current settings.
141 // TODO: Make it prettier. Currently it just repeats the command line.
142 SkString commandLine("bench_pictures:");
143 for (int i = 1; i < argc; i++) {
144 commandLine.appendf(" %s", *(argv+i));
145 }
146 commandLine.append("\n");
147
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000148 bool usePipe = false;
149 bool multiThreaded = false;
150 bool useTiles = false;
151 const char* widthString = NULL;
152 const char* heightString = NULL;
153 bool isPowerOf2Mode = false;
154 const char* mode = NULL;
reed@google.com006db0f2012-06-27 19:33:29 +0000155 for (++argv; argv < stop; ++argv) {
156 if (0 == strcmp(*argv, "--repeat")) {
157 ++argv;
158 if (argv < stop) {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000159 repeats = atoi(*argv);
160 if (repeats < 1) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000161 gLogger.logError("--repeat must be given a value > 0\n");
reed@google.com006db0f2012-06-27 19:33:29 +0000162 exit(-1);
163 }
164 } else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000165 gLogger.logError("Missing arg for --repeat\n");
reed@google.com006db0f2012-06-27 19:33:29 +0000166 usage(argv0);
167 exit(-1);
168 }
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000169 } else if (0 == strcmp(*argv, "--pipe")) {
170 usePipe = true;
scroggo@google.com9a412522012-09-07 15:21:18 +0000171 } else if (0 == strcmp(*argv, "--logFile")) {
172 argv++;
173 if (argv < stop) {
174 if (!gLogger.SetLogFile(*argv)) {
175 SkString str;
176 str.printf("Could not open %s for writing.", *argv);
177 gLogger.logError(str);
178 usage(argv0);
borenet@google.coma49bffd2012-09-13 18:54:48 +0000179 // TODO(borenet): We're disabling this for now, due to
180 // write-protected Android devices. The very short-term
181 // solution is to ignore the fact that we have no log file.
182 //exit(-1);
scroggo@google.com9a412522012-09-07 15:21:18 +0000183 }
184 } else {
185 gLogger.logError("Missing arg for --logFile\n");
186 usage(argv0);
187 exit(-1);
188 }
keyar@chromium.org795cd472012-08-02 18:57:53 +0000189 } else if (0 == strcmp(*argv, "--mode")) {
keyar@chromium.org795cd472012-08-02 18:57:53 +0000190
reed@google.com006db0f2012-06-27 19:33:29 +0000191 ++argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000192 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000193 gLogger.logError("Missing mode for --mode\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +0000194 usage(argv0);
195 exit(-1);
196 }
197
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000198 if (0 == strcmp(*argv, "record")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000199 renderer = SkNEW(sk_tools::RecordPictureRenderer);
keyar@chromium.org795cd472012-08-02 18:57:53 +0000200 } else if (0 == strcmp(*argv, "simple")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000201 renderer = SkNEW(sk_tools::SimplePictureRenderer);
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000202 } else if ((0 == strcmp(*argv, "tile")) || (0 == strcmp(*argv, "pow2tile"))) {
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000203 useTiles = true;
204 mode = *argv;
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000205
206 if (0 == strcmp(*argv, "pow2tile")) {
207 isPowerOf2Mode = true;
208 }
209
keyar@chromium.org795cd472012-08-02 18:57:53 +0000210 ++argv;
211 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000212 SkString err;
213 err.printf("Missing width for --mode %s\n", mode);
214 gLogger.logError(err);
keyar@chromium.org795cd472012-08-02 18:57:53 +0000215 usage(argv0);
216 exit(-1);
217 }
218
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000219 widthString = *argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000220 ++argv;
221 if (argv >= stop) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000222 gLogger.logError("Missing height for --mode tile\n");
keyar@chromium.org795cd472012-08-02 18:57:53 +0000223 usage(argv0);
224 exit(-1);
225 }
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000226 heightString = *argv;
keyar@chromium.org795cd472012-08-02 18:57:53 +0000227
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000228 ++argv;
229 if (argv < stop && 0 == strcmp(*argv, "multi")) {
230 multiThreaded = true;
keyar@chromium.org0665f252012-07-10 18:30:18 +0000231 } else {
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000232 --argv;
reed@google.com006db0f2012-06-27 19:33:29 +0000233 }
scroggo@google.com9a412522012-09-07 15:21:18 +0000234 } else if (0 == strcmp(*argv, "playbackCreation")) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000235 renderer = SkNEW(sk_tools::PlaybackCreationRenderer);
reed@google.com006db0f2012-06-27 19:33:29 +0000236 } else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000237 SkString err;
238 err.printf("%s is not a valid mode for --mode\n", *argv);
239 gLogger.logError(err);
keyar@chromium.org0665f252012-07-10 18:30:18 +0000240 usage(argv0);
reed@google.com006db0f2012-06-27 19:33:29 +0000241 exit(-1);
242 }
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000243 } else if (0 == strcmp(*argv, "--device")) {
244 ++argv;
245 if (argv >= stop) {
borenet@google.coma49bffd2012-09-13 18:54:48 +0000246 gLogger.logError("Missing mode for --device\n");
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000247 usage(argv0);
248 exit(-1);
249 }
250
251 if (0 == strcmp(*argv, "bitmap")) {
252 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
253 }
254#if SK_SUPPORT_GPU
255 else if (0 == strcmp(*argv, "gpu")) {
256 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
257 }
258#endif
259 else {
scroggo@google.com9a412522012-09-07 15:21:18 +0000260 SkString err;
261 err.printf("%s is not a valid mode for --device\n", *argv);
262 gLogger.logError(err);
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000263 usage(argv0);
264 exit(-1);
265 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000266 } else if (0 == strcmp(*argv, "--timers")) {
267 ++argv;
268 if (argv < stop) {
269 bool timerWall = false;
270 bool truncatedTimerWall = false;
271 bool timerCpu = false;
272 bool truncatedTimerCpu = false;
273 bool timerGpu = false;
274 for (char* t = *argv; *t; ++t) {
275 switch (*t) {
276 case 'w':
277 timerWall = true;
278 break;
279 case 'c':
280 timerCpu = true;
281 break;
282 case 'W':
283 truncatedTimerWall = true;
284 break;
285 case 'C':
286 truncatedTimerCpu = true;
287 break;
288 case 'g':
289 timerGpu = true;
290 break;
291 default: {
292 break;
293 }
294 }
295 }
296 benchmark->setTimersToShow(timerWall, truncatedTimerWall, timerCpu,
297 truncatedTimerCpu, timerGpu);
298 } else {
299 gLogger.logError("Missing arg for --timers\n");
300 usage(argv0);
301 exit(-1);
302 }
303 } else if (0 == strcmp(*argv, "--min")) {
304 benchmark->setPrintMin(true);
305 } else if (0 == strcmp(*argv, "--logPerIter")) {
306 ++argv;
307 if (argv < stop) {
308 bool log = atoi(*argv) != 0;
309 benchmark->setLogPerIter(log);
310 } else {
311 gLogger.logError("Missing arg for --logPerIter\n");
312 usage(argv0);
313 exit(-1);
314 }
reed@google.com006db0f2012-06-27 19:33:29 +0000315 } else if (0 == strcmp(*argv, "--help") || 0 == strcmp(*argv, "-h")) {
316 usage(argv0);
317 exit(0);
318 } else {
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000319 inputs->push_back(SkString(*argv));
reed@google.com006db0f2012-06-27 19:33:29 +0000320 }
321 }
322
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000323 if (useTiles) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000324 SkASSERT(NULL == renderer);
325 sk_tools::TiledPictureRenderer* tiledRenderer = SkNEW(sk_tools::TiledPictureRenderer);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000326 if (isPowerOf2Mode) {
327 int minWidth = atoi(widthString);
328 if (!SkIsPow2(minWidth) || minWidth < 0) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000329 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000330 SkString err;
scroggo@google.com5239c322012-09-11 19:15:32 +0000331 err.printf("-mode %s must be given a width"
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000332 " value that is a power of two\n", mode);
scroggo@google.com9a412522012-09-07 15:21:18 +0000333 gLogger.logError(err);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000334 exit(-1);
335 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000336 tiledRenderer->setTileMinPowerOf2Width(minWidth);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000337 } else if (sk_tools::is_percentage(widthString)) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000338 tiledRenderer->setTileWidthPercentage(atof(widthString));
339 if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
340 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000341 gLogger.logError("--mode tile must be given a width percentage > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000342 exit(-1);
343 }
344 } else {
scroggo@google.com5239c322012-09-11 19:15:32 +0000345 tiledRenderer->setTileWidth(atoi(widthString));
346 if (!(tiledRenderer->getTileWidth() > 0)) {
347 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000348 gLogger.logError("--mode tile must be given a width > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000349 exit(-1);
350 }
351 }
352
353 if (sk_tools::is_percentage(heightString)) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000354 tiledRenderer->setTileHeightPercentage(atof(heightString));
355 if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
356 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000357 gLogger.logError("--mode tile must be given a height percentage > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000358 exit(-1);
359 }
360 } else {
scroggo@google.com5239c322012-09-11 19:15:32 +0000361 tiledRenderer->setTileHeight(atoi(heightString));
362 if (!(tiledRenderer->getTileHeight() > 0)) {
363 tiledRenderer->unref();
scroggo@google.com9a412522012-09-07 15:21:18 +0000364 gLogger.logError("--mode tile must be given a height > 0\n");
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000365 exit(-1);
366 }
367 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000368 tiledRenderer->setMultiThreaded(multiThreaded);
369 tiledRenderer->setUsePipe(usePipe);
370 renderer = tiledRenderer;
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000371 } else if (usePipe) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000372 renderer = SkNEW(sk_tools::PipePictureRenderer);
scroggo@google.com58b4ead2012-08-31 16:15:22 +0000373 }
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000374 if (inputs->count() < 1) {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000375 SkDELETE(benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000376 usage(argv0);
377 exit(-1);
378 }
keyar@chromium.org163b5672012-08-01 17:53:29 +0000379
scroggo@google.com5239c322012-09-11 19:15:32 +0000380 if (NULL == renderer) {
381 renderer = SkNEW(sk_tools::SimplePictureRenderer);
keyar@chromium.org163b5672012-08-01 17:53:29 +0000382 }
scroggo@google.com5239c322012-09-11 19:15:32 +0000383 benchmark->setRenderer(renderer)->unref();
keyar@chromium.org163b5672012-08-01 17:53:29 +0000384 benchmark->setRepeats(repeats);
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000385 benchmark->setDeviceType(deviceType);
scroggo@google.com9a412522012-09-07 15:21:18 +0000386 benchmark->setLogger(&gLogger);
387 // Report current settings:
388 gLogger.logProgress(commandLine);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000389}
reed@google.com006db0f2012-06-27 19:33:29 +0000390
keyar@chromium.org163b5672012-08-01 17:53:29 +0000391static void process_input(const SkString& input, sk_tools::PictureBenchmark& benchmark) {
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000392 SkOSFile::Iter iter(input.c_str(), "skp");
393 SkString inputFilename;
394
395 if (iter.next(&inputFilename)) {
396 do {
397 SkString inputPath;
keyar@chromium.org163b5672012-08-01 17:53:29 +0000398 sk_tools::make_filepath(&inputPath, input, inputFilename);
399 run_single_benchmark(inputPath, benchmark);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000400 } while(iter.next(&inputFilename));
401 } else {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000402 run_single_benchmark(input, benchmark);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000403 }
reed@google.com006db0f2012-06-27 19:33:29 +0000404}
405
406int main(int argc, char* const argv[]) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000407#ifdef SK_ENABLE_INST_COUNT
408 gPrintInstCount = true;
409#endif
scroggo@google.com0a36f432012-09-10 20:29:13 +0000410 SkAutoGraphics ag;
reed@google.com006db0f2012-06-27 19:33:29 +0000411
scroggo@google.com5239c322012-09-11 19:15:32 +0000412 SkTArray<SkString> inputs;
413 sk_tools::PictureBenchmark benchmark;
414
415 parse_commandline(argc, argv, &inputs, &benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000416
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000417 for (int i = 0; i < inputs.count(); ++i) {
scroggo@google.com5239c322012-09-11 19:15:32 +0000418 process_input(inputs[i], benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000419 }
reed@google.com006db0f2012-06-27 19:33:29 +0000420}