blob: b5126a68bddd158a10041d4a14a9bcdd0ef844d4 [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"
scroggo@google.com4a26d9d2012-11-07 18:01:46 +00009#include "CopyTilesRenderer.h"
keyar@chromium.org163b5672012-08-01 17:53:29 +000010#include "PictureBenchmark.h"
scroggo@google.com161e1ba2013-03-04 16:41:06 +000011#include "PictureRenderingFlags.h"
scroggo@google.com9a412522012-09-07 15:21:18 +000012#include "SkBenchLogger.h"
scroggo@google.comd9ba9a02013-03-21 19:43:15 +000013#include "SkCommandLineFlags.h"
scroggo@google.com0a36f432012-09-10 20:29:13 +000014#include "SkGraphics.h"
scroggo@google.com5a7c6be2012-10-04 21:46:08 +000015#include "SkImageDecoder.h"
scroggo@google.combb281f72013-03-18 21:37:39 +000016#if LAZY_CACHE_STATS
17 #include "SkLazyPixelRef.h"
18#endif
19#include "SkLruImageCache.h"
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +000020#include "SkMath.h"
reed@google.com006db0f2012-06-27 19:33:29 +000021#include "SkOSFile.h"
22#include "SkPicture.h"
23#include "SkStream.h"
reed@google.com006db0f2012-06-27 19:33:29 +000024#include "picture_utils.h"
25
scroggo@google.com161e1ba2013-03-04 16:41:06 +000026
27SkBenchLogger gLogger;
28
29// Flags used by this file, in alphabetical order.
scroggo@google.coma560d00b2013-03-04 21:32:32 +000030DEFINE_bool(countRAM, false, "Count the RAM used for bitmap pixels in each skp file");
scroggo@google.com161e1ba2013-03-04 16:41:06 +000031DECLARE_bool(deferImageDecoding);
32DEFINE_string(filter, "",
33 "type:flag : Enable canvas filtering to disable a paint flag, "
34 "use no blur or low quality blur, or use no hinting or "
35 "slight hinting. For all flags except AAClip, specify the "
36 "type of primitive to effect, or choose all. for AAClip "
37 "alone, the filter affects all clips independent of type. "
38 "Specific flags are listed above.");
39DEFINE_string(logFile, "", "Destination for writing log output, in addition to stdout.");
40DEFINE_bool(logPerIter, false, "Log each repeat timer instead of mean.");
41DEFINE_bool(min, false, "Print the minimum times (instead of average).");
42DECLARE_int32(multi);
scroggo@google.com604e0c22013-04-09 21:25:46 +000043DECLARE_string(readPath);
scroggo@google.com161e1ba2013-03-04 16:41:06 +000044DEFINE_int32(repeat, 1, "Set the number of times to repeat each test.");
45DEFINE_bool(timeIndividualTiles, false, "Report times for drawing individual tiles, rather than "
46 "times for drawing the whole page. Requires tiled rendering.");
47DEFINE_string(timers, "", "[wcgWC]*: Display wall, cpu, gpu, truncated wall or truncated cpu time"
48 " for each picture.");
scroggo@google.comcc690202013-03-04 19:56:21 +000049DEFINE_bool(trackDeferredCaching, false, "Only meaningful with --deferImageDecoding and "
50 "LAZY_CACHE_STATS set to true. Report percentage of cache hits when using deferred "
51 "image decoding.");
reed@google.com006db0f2012-06-27 19:33:29 +000052
caryclark@google.coma3622372012-11-06 21:26:13 +000053static char const * const gFilterTypes[] = {
54 "paint",
55 "point",
56 "line",
57 "bitmap",
58 "rect",
jvanverth@google.comd3c208c2013-01-22 13:54:52 +000059 "oval",
caryclark@google.coma3622372012-11-06 21:26:13 +000060 "path",
61 "text",
62 "all",
63};
64
65static const size_t kFilterTypesCount = sizeof(gFilterTypes) / sizeof(gFilterTypes[0]);
66
67static char const * const gFilterFlags[] = {
68 "antiAlias",
69 "filterBitmap",
70 "dither",
71 "underlineText",
72 "strikeThruText",
73 "fakeBoldText",
74 "linearText",
75 "subpixelText",
76 "devKernText",
77 "LCDRenderText",
78 "embeddedBitmapText",
79 "autoHinting",
80 "verticalText",
81 "genA8FromLCD",
82 "blur",
83 "hinting",
84 "slightHinting",
caryclark@google.come3e940c2012-11-07 16:42:17 +000085 "AAClip",
caryclark@google.coma3622372012-11-06 21:26:13 +000086};
87
88static const size_t kFilterFlagsCount = sizeof(gFilterFlags) / sizeof(gFilterFlags[0]);
89
90static SkString filtersName(sk_tools::PictureRenderer::DrawFilterFlags* drawFilters) {
91 int all = drawFilters[0];
92 size_t tIndex;
93 for (tIndex = 1; tIndex < SkDrawFilter::kTypeCount; ++tIndex) {
94 all &= drawFilters[tIndex];
95 }
96 SkString result;
97 for (size_t fIndex = 0; fIndex < kFilterFlagsCount; ++fIndex) {
98 SkString types;
99 if (all & (1 << fIndex)) {
100 types = gFilterTypes[SkDrawFilter::kTypeCount];
101 } else {
102 for (tIndex = 0; tIndex < SkDrawFilter::kTypeCount; ++tIndex) {
103 if (drawFilters[tIndex] & (1 << fIndex)) {
104 types += gFilterTypes[tIndex];
105 }
106 }
107 }
108 if (!types.size()) {
109 continue;
110 }
111 result += "_";
112 result += types;
113 result += ".";
114 result += gFilterFlags[fIndex];
115 }
116 return result;
117}
118
119static SkString filterTypesUsage() {
120 SkString result;
121 for (size_t index = 0; index < kFilterTypesCount; ++index) {
122 result += gFilterTypes[index];
123 if (index < kFilterTypesCount - 1) {
124 result += " | ";
125 }
126 }
127 return result;
128}
129
130static SkString filterFlagsUsage() {
131 SkString result;
132 size_t len = 0;
133 for (size_t index = 0; index < kFilterFlagsCount; ++index) {
134 result += gFilterFlags[index];
135 if (result.size() - len >= 72) {
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000136 result += "\n\t\t";
caryclark@google.coma3622372012-11-06 21:26:13 +0000137 len = result.size();
138 }
139 if (index < kFilterFlagsCount - 1) {
140 result += " | ";
141 }
142 }
143 return result;
144}
145
scroggo@google.combb281f72013-03-18 21:37:39 +0000146// These are defined in PictureRenderingFlags.cpp
147extern SkLruImageCache gLruImageCache;
148extern bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap* bitmap);
scroggo@google.comf8d7d272013-02-22 21:38:35 +0000149
scroggo@google.comcc690202013-03-04 19:56:21 +0000150#if LAZY_CACHE_STATS
151static int32_t gTotalCacheHits;
152static int32_t gTotalCacheMisses;
153#endif
154
borenet@google.com66bcbd12012-09-17 18:26:06 +0000155static bool run_single_benchmark(const SkString& inputPath,
keyar@chromium.org163b5672012-08-01 17:53:29 +0000156 sk_tools::PictureBenchmark& benchmark) {
reed@google.com006db0f2012-06-27 19:33:29 +0000157 SkFILEStream inputStream;
158
reed@google.com006db0f2012-06-27 19:33:29 +0000159 inputStream.setPath(inputPath.c_str());
160 if (!inputStream.isValid()) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000161 SkString err;
162 err.printf("Could not open file %s\n", inputPath.c_str());
163 gLogger.logError(err);
borenet@google.com66bcbd12012-09-17 18:26:06 +0000164 return false;
reed@google.com006db0f2012-06-27 19:33:29 +0000165 }
166
scroggo@google.coma560d00b2013-03-04 21:32:32 +0000167 // Since the old picture has been deleted, all pixels should be cleared.
168 SkASSERT(gLruImageCache.getImageCacheUsed() == 0);
169 if (FLAGS_countRAM) {
170 // Set the limit to zero, so all pixels will be kept
171 gLruImageCache.setImageCacheLimit(0);
172 }
173
borenet@google.com66bcbd12012-09-17 18:26:06 +0000174 bool success = false;
scroggo@google.comf8d7d272013-02-22 21:38:35 +0000175 SkPicture* picture;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000176 if (FLAGS_deferImageDecoding) {
scroggo@google.comf8d7d272013-02-22 21:38:35 +0000177 picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &lazy_decode_bitmap));
178 } else {
179 picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &SkImageDecoder::DecodeMemory));
180 }
181 SkAutoTDelete<SkPicture> ad(picture);
182
borenet@google.com66bcbd12012-09-17 18:26:06 +0000183 if (!success) {
184 SkString err;
185 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str());
186 gLogger.logError(err);
187 return false;
188 }
reed@google.com006db0f2012-06-27 19:33:29 +0000189
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000190 SkString filename;
191 sk_tools::get_basename(&filename, inputPath);
keyar@chromium.orgdb9a5fb2012-08-21 17:57:59 +0000192
193 SkString result;
scroggo@google.comf8d7d272013-02-22 21:38:35 +0000194 result.printf("running bench [%i %i] %s ", picture->width(), picture->height(),
195 filename.c_str());
scroggo@google.com9a412522012-09-07 15:21:18 +0000196 gLogger.logProgress(result);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000197
scroggo@google.comf8d7d272013-02-22 21:38:35 +0000198 benchmark.run(picture);
scroggo@google.comcc690202013-03-04 19:56:21 +0000199
200#if LAZY_CACHE_STATS
201 if (FLAGS_trackDeferredCaching) {
202 int32_t cacheHits = SkLazyPixelRef::GetCacheHits();
203 int32_t cacheMisses = SkLazyPixelRef::GetCacheMisses();
204 SkLazyPixelRef::ResetCacheStats();
scroggo@google.coma560d00b2013-03-04 21:32:32 +0000205 SkString hitString;
206 hitString.printf("Cache hit rate: %f\n", (double) cacheHits / (cacheHits + cacheMisses));
207 gLogger.logProgress(hitString);
scroggo@google.comcc690202013-03-04 19:56:21 +0000208 gTotalCacheHits += cacheHits;
209 gTotalCacheMisses += cacheMisses;
210 }
211#endif
scroggo@google.coma560d00b2013-03-04 21:32:32 +0000212 if (FLAGS_countRAM) {
213 SkString ramCount("RAM used for bitmaps: ");
214 size_t bytes = gLruImageCache.getImageCacheUsed();
215 if (bytes > 1024) {
216 size_t kb = bytes / 1024;
217 if (kb > 1024) {
218 size_t mb = kb / 1024;
219 ramCount.appendf("%zi MB\n", mb);
220 } else {
221 ramCount.appendf("%zi KB\n", kb);
222 }
223 } else {
224 ramCount.appendf("%zi bytes\n", bytes);
225 }
226 gLogger.logProgress(ramCount);
227 }
scroggo@google.comcc690202013-03-04 19:56:21 +0000228
borenet@google.com66bcbd12012-09-17 18:26:06 +0000229 return true;
keyar@chromium.org0665f252012-07-10 18:30:18 +0000230}
231
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000232static void setup_benchmark(sk_tools::PictureBenchmark* benchmark) {
caryclark@google.coma3622372012-11-06 21:26:13 +0000233 sk_tools::PictureRenderer::DrawFilterFlags drawFilters[SkDrawFilter::kTypeCount];
234 sk_bzero(drawFilters, sizeof(drawFilters));
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000235
236 if (FLAGS_filter.count() > 0) {
237 const char* filters = FLAGS_filter[0];
238 const char* colon = strchr(filters, ':');
239 if (colon) {
scroggo@google.comcc690202013-03-04 19:56:21 +0000240 int32_t type = -1;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000241 size_t typeLen = colon - filters;
242 for (size_t tIndex = 0; tIndex < kFilterTypesCount; ++tIndex) {
243 if (typeLen == strlen(gFilterTypes[tIndex])
244 && !strncmp(filters, gFilterTypes[tIndex], typeLen)) {
scroggo@google.comcc690202013-03-04 19:56:21 +0000245 type = SkToS32(tIndex);
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000246 break;
reed@google.com006db0f2012-06-27 19:33:29 +0000247 }
reed@google.com006db0f2012-06-27 19:33:29 +0000248 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000249 if (type < 0) {
junov@chromium.org9313ca42012-11-02 18:11:49 +0000250 SkString err;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000251 err.printf("Unknown type for --filter %s\n", filters);
junov@chromium.org9313ca42012-11-02 18:11:49 +0000252 gLogger.logError(err);
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000253 exit(-1);
junov@chromium.org9313ca42012-11-02 18:11:49 +0000254 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000255 int flag = -1;
256 size_t flagLen = strlen(filters) - typeLen - 1;
257 for (size_t fIndex = 0; fIndex < kFilterFlagsCount; ++fIndex) {
258 if (flagLen == strlen(gFilterFlags[fIndex])
259 && !strncmp(colon + 1, gFilterFlags[fIndex], flagLen)) {
260 flag = 1 << fIndex;
261 break;
262 }
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000263 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000264 if (flag < 0) {
scroggo@google.com9a412522012-09-07 15:21:18 +0000265 SkString err;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000266 err.printf("Unknown flag for --filter %s\n", filters);
scroggo@google.com9a412522012-09-07 15:21:18 +0000267 gLogger.logError(err);
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000268 exit(-1);
reed@google.com006db0f2012-06-27 19:33:29 +0000269 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000270 for (int index = 0; index < SkDrawFilter::kTypeCount; ++index) {
271 if (type != SkDrawFilter::kTypeCount && index != type) {
272 continue;
scroggo@google.com5239c322012-09-11 19:15:32 +0000273 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000274 drawFilters[index] = (sk_tools::PictureRenderer::DrawFilterFlags)
275 (drawFilters[index] | flag);
scroggo@google.com5239c322012-09-11 19:15:32 +0000276 }
reed@google.com006db0f2012-06-27 19:33:29 +0000277 } else {
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000278 SkString err;
279 err.printf("Unknown arg for --filter %s : missing colon\n", filters);
280 gLogger.logError(err);
281 exit(-1);
reed@google.com006db0f2012-06-27 19:33:29 +0000282 }
283 }
284
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000285 if (FLAGS_timers.count() > 0) {
286 size_t index = 0;
287 bool timerWall = false;
288 bool truncatedTimerWall = false;
289 bool timerCpu = false;
290 bool truncatedTimerCpu = false;
291 bool timerGpu = false;
292 while (index < strlen(FLAGS_timers[0])) {
293 switch (FLAGS_timers[0][index]) {
294 case 'w':
295 timerWall = true;
296 break;
297 case 'c':
298 timerCpu = true;
299 break;
300 case 'W':
301 truncatedTimerWall = true;
302 break;
303 case 'C':
304 truncatedTimerCpu = true;
305 break;
306 case 'g':
307 timerGpu = true;
scroggo@google.com0556ea02013-02-08 19:38:21 +0000308 break;
309 default:
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000310 SkDebugf("mystery character\n");
scroggo@google.com0556ea02013-02-08 19:38:21 +0000311 break;
312 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000313 index++;
scroggo@google.combcdf2ec2012-09-20 14:42:33 +0000314 }
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000315 benchmark->setTimersToShow(timerWall, truncatedTimerWall, timerCpu, truncatedTimerCpu,
316 timerGpu);
reed@google.com006db0f2012-06-27 19:33:29 +0000317 }
keyar@chromium.org163b5672012-08-01 17:53:29 +0000318
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000319 SkString errorString;
320 SkAutoTUnref<sk_tools::PictureRenderer> renderer(parseRenderer(errorString,
321 kBench_PictureTool));
322
323 if (errorString.size() > 0) {
324 gLogger.logError(errorString);
keyar@chromium.org163b5672012-08-01 17:53:29 +0000325 }
junov@chromium.org9313ca42012-11-02 18:11:49 +0000326
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000327 if (NULL == renderer.get()) {
328 exit(-1);
329 }
330
331 if (FLAGS_timeIndividualTiles) {
332 if (FLAGS_multi > 1) {
333 gLogger.logError("Cannot time individual tiles with more than one thread.\n");
334 exit(-1);
335 }
336 sk_tools::TiledPictureRenderer* tiledRenderer = renderer->getTiledRenderer();
337 if (NULL == tiledRenderer) {
338 gLogger.logError("--timeIndividualTiles requires tiled rendering.\n");
339 exit(-1);
340 }
341 if (!tiledRenderer->supportsTimingIndividualTiles()) {
342 gLogger.logError("This renderer does not support --timeIndividualTiles.\n");
343 exit(-1);
344 }
345 benchmark->setTimeIndividualTiles(true);
346 }
347
scroggo@google.com604e0c22013-04-09 21:25:46 +0000348 if (FLAGS_readPath.count() < 1) {
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000349 gLogger.logError(".skp files or directories are required.\n");
350 exit(-1);
351 }
352
caryclark@google.coma3622372012-11-06 21:26:13 +0000353 renderer->setDrawFilters(drawFilters, filtersName(drawFilters));
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000354 benchmark->setPrintMin(FLAGS_min);
355 benchmark->setLogPerIter(FLAGS_logPerIter);
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000356 benchmark->setRenderer(renderer);
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000357 benchmark->setRepeats(FLAGS_repeat);
scroggo@google.com9a412522012-09-07 15:21:18 +0000358 benchmark->setLogger(&gLogger);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000359}
reed@google.com006db0f2012-06-27 19:33:29 +0000360
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000361static int process_input(const char* input,
borenet@google.com66bcbd12012-09-17 18:26:06 +0000362 sk_tools::PictureBenchmark& benchmark) {
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000363 SkString inputAsSkString(input);
364 SkOSFile::Iter iter(input, "skp");
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000365 SkString inputFilename;
borenet@google.com66bcbd12012-09-17 18:26:06 +0000366 int failures = 0;
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000367 if (iter.next(&inputFilename)) {
368 do {
369 SkString inputPath;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000370 sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename);
borenet@google.com57837bf2012-09-19 17:28:29 +0000371 if (!run_single_benchmark(inputPath, benchmark)) {
borenet@google.com66bcbd12012-09-17 18:26:06 +0000372 ++failures;
borenet@google.com57837bf2012-09-19 17:28:29 +0000373 }
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000374 } while(iter.next(&inputFilename));
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000375 } else if (SkStrEndsWith(input, ".skp")) {
376 if (!run_single_benchmark(inputAsSkString, benchmark)) {
borenet@google.com66bcbd12012-09-17 18:26:06 +0000377 ++failures;
borenet@google.com57837bf2012-09-19 17:28:29 +0000378 }
379 } else {
380 SkString warning;
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000381 warning.printf("Warning: skipping %s\n", input);
borenet@google.com57837bf2012-09-19 17:28:29 +0000382 gLogger.logError(warning);
keyar@chromium.orgd1dc9202012-07-09 18:32:08 +0000383 }
borenet@google.com66bcbd12012-09-17 18:26:06 +0000384 return failures;
reed@google.com006db0f2012-06-27 19:33:29 +0000385}
386
caryclark@google.com5987f582012-10-02 18:33:14 +0000387int tool_main(int argc, char** argv);
388int tool_main(int argc, char** argv) {
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000389 SkString usage;
390 usage.printf("Time drawing .skp files.\n"
391 "\tPossible arguments for --filter: [%s]\n\t\t[%s]",
392 filterTypesUsage().c_str(), filterFlagsUsage().c_str());
scroggo@google.comd9ba9a02013-03-21 19:43:15 +0000393 SkCommandLineFlags::SetUsage(usage.c_str());
394 SkCommandLineFlags::Parse(argc, argv);
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000395
396 if (FLAGS_repeat < 1) {
397 SkString error;
398 error.printf("--repeats must be >= 1. Was %i\n", FLAGS_repeat);
399 gLogger.logError(error);
400 exit(-1);
401 }
402
403 if (FLAGS_logFile.count() == 1) {
404 if (!gLogger.SetLogFile(FLAGS_logFile[0])) {
405 SkString str;
406 str.printf("Could not open %s for writing.\n", FLAGS_logFile[0]);
407 gLogger.logError(str);
408 // TODO(borenet): We're disabling this for now, due to
409 // write-protected Android devices. The very short-term
410 // solution is to ignore the fact that we have no log file.
411 //exit(-1);
412 }
413 }
414
415
bsalomon@google.com4e230682013-01-15 20:37:04 +0000416#if SK_ENABLE_INST_COUNT
scroggo@google.com5239c322012-09-11 19:15:32 +0000417 gPrintInstCount = true;
418#endif
scroggo@google.com0a36f432012-09-10 20:29:13 +0000419 SkAutoGraphics ag;
reed@google.com006db0f2012-06-27 19:33:29 +0000420
scroggo@google.com5239c322012-09-11 19:15:32 +0000421 sk_tools::PictureBenchmark benchmark;
422
scroggo@google.com161e1ba2013-03-04 16:41:06 +0000423 setup_benchmark(&benchmark);
reed@google.com006db0f2012-06-27 19:33:29 +0000424
borenet@google.com66bcbd12012-09-17 18:26:06 +0000425 int failures = 0;
scroggo@google.com604e0c22013-04-09 21:25:46 +0000426 for (int i = 0; i < FLAGS_readPath.count(); ++i) {
427 failures += process_input(FLAGS_readPath[i], benchmark);
borenet@google.com66bcbd12012-09-17 18:26:06 +0000428 }
429
430 if (failures != 0) {
431 SkString err;
432 err.printf("Failed to run %i benchmarks.\n", failures);
433 gLogger.logError(err);
434 return 1;
reed@google.com006db0f2012-06-27 19:33:29 +0000435 }
scroggo@google.comcc690202013-03-04 19:56:21 +0000436#if LAZY_CACHE_STATS
437 if (FLAGS_trackDeferredCaching) {
438 SkDebugf("Total cache hit rate: %f\n",
439 (double) gTotalCacheHits / (gTotalCacheHits + gTotalCacheMisses));
440 }
441#endif
caryclark@google.com868e1f62012-10-02 20:00:03 +0000442 return 0;
reed@google.com006db0f2012-06-27 19:33:29 +0000443}
caryclark@google.com5987f582012-10-02 18:33:14 +0000444
445#if !defined SK_BUILD_FOR_IOS
446int main(int argc, char * const argv[]) {
447 return tool_main(argc, (char**) argv);
448}
449#endif