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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 "Loop until timer overhead is at most this fraction of our measurm
ents."); | 59 "Loop until timer overhead is at most this fraction of our measurm
ents."); |
60 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); | 60 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); |
61 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); | 61 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow
s to lag."); |
62 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
back to " | 62 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling
back to " |
63 "software path rendering."); | 63 "software path rendering."); |
64 | 64 |
65 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); | 65 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); |
66 DEFINE_int32(maxCalibrationAttempts, 3, | 66 DEFINE_int32(maxCalibrationAttempts, 3, |
67 "Try up to this many times to guess loops for a bench, or skip the
bench."); | 67 "Try up to this many times to guess loops for a bench, or skip the
bench."); |
68 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); | 68 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); |
69 DEFINE_string(properties, "", | |
70 "Space-separated key/value pairs to add to JSON identifying this n
anobench run."); | |
71 DEFINE_string(key, "", | |
72 "Space-separated key/value pairs to add to JSON identifying this b
ench config."); | |
73 | |
74 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); | 69 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); |
75 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); | 70 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); |
76 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); | 71 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); |
77 | 72 |
78 static SkString humanize(double ms) { | 73 static SkString humanize(double ms) { |
79 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); | 74 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); |
80 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); | 75 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); |
81 #ifdef SK_BUILD_FOR_WIN | 76 #ifdef SK_BUILD_FOR_WIN |
82 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); | 77 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); |
83 #else | 78 #else |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // The SKP we read off disk doesn't have a BBH. Re-record s
o it grows one. | 480 // The SKP we read off disk doesn't have a BBH. Re-record s
o it grows one. |
486 // Here we use an SkTileGrid with parameters optimized for F
LAGS_clip. | 481 // Here we use an SkTileGrid with parameters optimized for F
LAGS_clip. |
487 const SkTileGridFactory::TileGridInfo info = { | 482 const SkTileGridFactory::TileGridInfo info = { |
488 SkISize::Make(fClip.width(), fClip.height()), // tile i
nterval | 483 SkISize::Make(fClip.width(), fClip.height()), // tile i
nterval |
489 SkISize::Make(0,0), // margin | 484 SkISize::Make(0,0), // margin |
490 SkIPoint::Make(fClip.left(), fClip.top()), // offset | 485 SkIPoint::Make(fClip.left(), fClip.top()), // offset |
491 }; | 486 }; |
492 SkTileGridFactory factory(info); | 487 SkTileGridFactory factory(info); |
493 SkPictureRecorder recorder; | 488 SkPictureRecorder recorder; |
494 pic->playback(recorder.beginRecording(pic->cullRect().width(
), | 489 pic->playback(recorder.beginRecording(pic->cullRect().width(
), |
495 pic->cullRect().height
(), | 490 pic->cullRect().height
(), |
496 &factory)); | 491 &factory)); |
497 pic.reset(recorder.endRecording()); | 492 pic.reset(recorder.endRecording()); |
498 } | 493 } |
499 | 494 |
500 fSourceType = "skp"; | 495 fSourceType = "skp"; |
501 return SkNEW_ARGS(SKPBench, | 496 return SkNEW_ARGS(SKPBench, |
502 (name.c_str(), pic.get(), fClip, fScales[fCurrentScale])
); | 497 (name.c_str(), pic.get(), fClip, fScales[fCurrentScale])
); |
503 } | 498 } |
504 fCurrentSKP = 0; | 499 fCurrentSKP = 0; |
505 fCurrentScale++; | 500 fCurrentScale++; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 685 |
691 return 0; | 686 return 0; |
692 } | 687 } |
693 | 688 |
694 #if !defined SK_BUILD_FOR_IOS | 689 #if !defined SK_BUILD_FOR_IOS |
695 int main(int argc, char** argv) { | 690 int main(int argc, char** argv) { |
696 SkCommandLineFlags::Parse(argc, argv); | 691 SkCommandLineFlags::Parse(argc, argv); |
697 return nanobench_main(); | 692 return nanobench_main(); |
698 } | 693 } |
699 #endif | 694 #endif |
OLD | NEW |