diff options
author | mtklein <mtklein@chromium.org> | 2014-11-06 08:04:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-06 08:04:35 -0800 |
commit | 527930fdbbba2a20f98b43821c6b72367e7b2d64 (patch) | |
tree | 4e64969c5eff07ff06e14a9025ed30fe3b56283d | |
parent | e27065ae243575f6d5d545909ad3030773c14db8 (diff) | |
download | skia-527930fdbbba2a20f98b43821c6b72367e7b2d64.tar.gz |
Detect loops overflow for gpu benches.
NOTREECHECKS=true
BUG=skia:
Review URL: https://codereview.chromium.org/709473002
-rw-r--r-- | bench/nanobench.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 31b69fa6e..aade59054 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -125,7 +125,8 @@ static int detect_forever_loops(int loops) { static int clamp_loops(int loops) { if (loops < 1) { - SkDebugf("ERROR: clamping loops from %d to 1.\n", loops); + SkDebugf("ERROR: clamping loops from %d to 1. " + "There's probably something wrong with the bench.\n", loops); return 1; } if (loops > FLAGS_maxLoops) { @@ -228,6 +229,11 @@ static int gpu_bench(SkGLContext* gl, loops = 1; double elapsed = 0; do { + if (1<<30 == loops) { + // We're about to wrap. Something's wrong with the bench. + loops = 0; + break; + } loops *= 2; // If the GPU lets frames lag at all, we need to make sure we're timing // _this_ round, not still timing last round. We force this by looping |