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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
back to " | 63 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
back to " |
64 "software path rendering."); | 64 "software path rendering."); |
65 | 65 |
66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 66 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
67 DEFINE_int32(maxCalibrationAttempts, 3, | 67 DEFINE_int32(maxCalibrationAttempts, 3, |
68 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 68 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 69 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |
70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 70 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |
71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 71 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |
72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); | 72 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); |
| 73 DEFINE_int32(benchTile, 256, "Tile dimension used for SKP playback."); |
73 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); | 74 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); |
74 | 75 |
75 static SkString humanize(double ms) { | 76 static SkString humanize(double ms) { |
76 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 77 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
77 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); | 78 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); |
78 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); | 79 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); |
79 #ifdef SK_BUILD_FOR_WIN | 80 #ifdef SK_BUILD_FOR_WIN |
80 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); | 81 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); |
81 #else | 82 #else |
82 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); | 83 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 // Then once each for each scale as SKPBenches (playback). | 508 // Then once each for each scale as SKPBenches (playback). |
508 while (fCurrentScale < fScales.count()) { | 509 while (fCurrentScale < fScales.count()) { |
509 while (fCurrentSKP < fSKPs.count()) { | 510 while (fCurrentSKP < fSKPs.count()) { |
510 const SkString& path = fSKPs[fCurrentSKP++]; | 511 const SkString& path = fSKPs[fCurrentSKP++]; |
511 SkAutoTUnref<SkPicture> pic; | 512 SkAutoTUnref<SkPicture> pic; |
512 if (!ReadPicture(path.c_str(), &pic)) { | 513 if (!ReadPicture(path.c_str(), &pic)) { |
513 continue; | 514 continue; |
514 } | 515 } |
515 if (FLAGS_bbh) { | 516 if (FLAGS_bbh) { |
516 // The SKP we read off disk doesn't have a BBH. Re-record s
o it grows one. | 517 // The SKP we read off disk doesn't have a BBH. Re-record s
o it grows one. |
517 // Here we use an SkTileGrid with parameters optimized for F
LAGS_clip. | |
518 const SkTileGridFactory::TileGridInfo info = { | 518 const SkTileGridFactory::TileGridInfo info = { |
519 SkISize::Make(fClip.width(), fClip.height()), // tile i
nterval | 519 SkISize::Make(FLAGS_benchTile, FLAGS_benchTile), // til
e interval |
520 SkISize::Make(0,0), // margin | 520 SkISize::Make(0,0), // mar
gin |
521 SkIPoint::Make(fClip.left(), fClip.top()), // offset | 521 SkIPoint::Make(0,0), // off
set |
522 }; | 522 }; |
523 SkTileGridFactory factory(info); | 523 SkTileGridFactory factory(info); |
524 SkPictureRecorder recorder; | 524 SkPictureRecorder recorder; |
525 pic->playback(recorder.beginRecording(pic->cullRect().width(
), | 525 pic->playback(recorder.beginRecording(pic->cullRect().width(
), |
526 pic->cullRect().height
(), | 526 pic->cullRect().height
(), |
527 &factory)); | 527 &factory)); |
528 pic.reset(recorder.endRecording()); | 528 pic.reset(recorder.endRecording()); |
529 } | 529 } |
530 SkString name = SkOSPath::Basename(path.c_str()); | 530 SkString name = SkOSPath::Basename(path.c_str()); |
531 fSourceType = "skp"; | 531 fSourceType = "skp"; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 734 |
735 return 0; | 735 return 0; |
736 } | 736 } |
737 | 737 |
738 #if !defined SK_BUILD_FOR_IOS | 738 #if !defined SK_BUILD_FOR_IOS |
739 int main(int argc, char** argv) { | 739 int main(int argc, char** argv) { |
740 SkCommandLineFlags::Parse(argc, argv); | 740 SkCommandLineFlags::Parse(argc, argv); |
741 return nanobench_main(); | 741 return nanobench_main(); |
742 } | 742 } |
743 #endif | 743 #endif |
OLD | NEW |