Add loopSKP flag to nanobench
Adds a loopSKP flag that forces SKPBenches to draw with only 1 loop.
BUG=skia:
Review URL: https://codereview.chromium.org/1203193002
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 13ae9f6..9f3887b 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -92,6 +92,7 @@
DEFINE_string(zoom, "1.0,1", "Comma-separated scale,step zoom factors for SKPs.");
DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
+DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test.");
DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
@@ -272,7 +273,8 @@
// First figure out approximately how many loops of bench it takes to make overhead negligible.
double bench_plus_overhead = 0.0;
int round = 0;
- if (kAutoTuneLoops == FLAGS_loops) {
+ int loops = bench->calculateLoops(FLAGS_loops);
+ if (kAutoTuneLoops == loops) {
while (bench_plus_overhead < overhead) {
if (round++ == FLAGS_maxCalibrationAttempts) {
SkDebugf("WARNING: Can't estimate loops for %s (%s vs. %s); skipping.\n",
@@ -299,7 +301,6 @@
// bench_plus_overhead - overhead)
//
// Luckily, this also works well in practice. :)
- int loops = FLAGS_loops;
if (kAutoTuneLoops == loops) {
const double numer = overhead / FLAGS_overheadGoal - overhead;
const double denom = bench_plus_overhead - overhead;
@@ -320,7 +321,7 @@
double* samples,
int maxGpuFrameLag) {
// First, figure out how many loops it'll take to get a frame up to FLAGS_gpuMs.
- int loops = FLAGS_loops;
+ int loops = bench->calculateLoops(FLAGS_loops);
if (kAutoTuneLoops == loops) {
loops = 1;
double elapsed = 0;
@@ -715,8 +716,8 @@
fSourceType = "skp";
fBenchType = "playback";
return SkNEW_ARGS(SKPBench,
- (name.c_str(), pic.get(), fClip,
- fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]));
+ (name.c_str(), pic.get(), fClip, fScales[fCurrentScale],
+ fUseMPDs[fCurrentUseMPD++], FLAGS_loopSKP));
}
fCurrentUseMPD = 0;
@@ -741,7 +742,7 @@
SkMatrix anim = SkMatrix::I();
anim.setScale(fZoomScale, fZoomScale);
return SkNEW_ARGS(SKPAnimationBench, (name.c_str(), pic.get(), fClip, anim,
- fZoomSteps));
+ fZoomSteps, FLAGS_loopSKP));
}
}