| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "BenchLogger.h" | 8 #include "BenchLogger.h" |
| 9 #include "Timer.h" | 9 #include "Timer.h" |
| 10 #include "CopyTilesRenderer.h" | 10 #include "CopyTilesRenderer.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 191 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
| 192 | 192 |
| 193 if (NULL == picture.get()) { | 193 if (NULL == picture.get()) { |
| 194 SkString err; | 194 SkString err; |
| 195 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 195 err.printf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
| 196 gLogger.logError(err); | 196 gLogger.logError(err); |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 | 199 |
| 200 SkString filename = SkOSPath::SkBasename(inputPath.c_str()); | 200 SkString filename = SkOSPath::Basename(inputPath.c_str()); |
| 201 | 201 |
| 202 gWriter.bench(filename.c_str(), picture->width(), picture->height()); | 202 gWriter.bench(filename.c_str(), picture->width(), picture->height()); |
| 203 | 203 |
| 204 benchmark.run(picture); | 204 benchmark.run(picture); |
| 205 | 205 |
| 206 #if SK_LAZY_CACHE_STATS | 206 #if SK_LAZY_CACHE_STATS |
| 207 if (FLAGS_trackDeferredCaching) { | 207 if (FLAGS_trackDeferredCaching) { |
| 208 int cacheHits = pool->getCacheHits(); | 208 int cacheHits = pool->getCacheHits(); |
| 209 int cacheMisses = pool->getCacheMisses(); | 209 int cacheMisses = pool->getCacheMisses(); |
| 210 pool->resetCacheHitsAndMisses(); | 210 pool->resetCacheHitsAndMisses(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 static int process_input(const char* input, | 371 static int process_input(const char* input, |
| 372 sk_tools::PictureBenchmark& benchmark) { | 372 sk_tools::PictureBenchmark& benchmark) { |
| 373 SkString inputAsSkString(input); | 373 SkString inputAsSkString(input); |
| 374 SkOSFile::Iter iter(input, "skp"); | 374 SkOSFile::Iter iter(input, "skp"); |
| 375 SkString inputFilename; | 375 SkString inputFilename; |
| 376 int failures = 0; | 376 int failures = 0; |
| 377 if (iter.next(&inputFilename)) { | 377 if (iter.next(&inputFilename)) { |
| 378 do { | 378 do { |
| 379 SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str
()); | 379 SkString inputPath = SkOSPath::Join(input, inputFilename.c_str()); |
| 380 if (!run_single_benchmark(inputPath, benchmark)) { | 380 if (!run_single_benchmark(inputPath, benchmark)) { |
| 381 ++failures; | 381 ++failures; |
| 382 } | 382 } |
| 383 } while(iter.next(&inputFilename)); | 383 } while(iter.next(&inputFilename)); |
| 384 } else if (SkStrEndsWith(input, ".skp")) { | 384 } else if (SkStrEndsWith(input, ".skp")) { |
| 385 if (!run_single_benchmark(inputAsSkString, benchmark)) { | 385 if (!run_single_benchmark(inputAsSkString, benchmark)) { |
| 386 ++failures; | 386 ++failures; |
| 387 } | 387 } |
| 388 } else { | 388 } else { |
| 389 SkString warning; | 389 SkString warning; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 #endif | 466 #endif |
| 467 gWriter.end(); | 467 gWriter.end(); |
| 468 return 0; | 468 return 0; |
| 469 } | 469 } |
| 470 | 470 |
| 471 #if !defined SK_BUILD_FOR_IOS | 471 #if !defined SK_BUILD_FOR_IOS |
| 472 int main(int argc, char * const argv[]) { | 472 int main(int argc, char * const argv[]) { |
| 473 return tool_main(argc, (char**) argv); | 473 return tool_main(argc, (char**) argv); |
| 474 } | 474 } |
| 475 #endif | 475 #endif |
| OLD | NEW |