Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: bench/nanobench.cpp

Issue 709473002: Detect loops overflow for gpu benches. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 30 Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 31b69fa6e2bbc4e672ea0a5f99cc8d19a615a37e..aade5905410a31538cd38fa82e77ad73d5f3cd5f 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698