Do not try to time kFailedLoops
Move the check for kFailedLoops above code that times the benchmark.
This matches the comment ("Can't be timed") and prevents an infinite
loop.
Bug: skia:6774
Change-Id: Iacdc1ca1d11afcf05afac60e4eb0d8d9a12f800e
Reviewed-on: https://skia-review.googlesource.com/53803
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 0458330..61de8a9 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -1284,6 +1284,12 @@
? setup_gpu_bench(target, bench.get(), maxFrameLag)
: setup_cpu_bench(overhead, target, bench.get());
+ if (kFailedLoops == loops) {
+ // Can't be timed. A warning note has already been printed.
+ cleanup_run(target);
+ continue;
+ }
+
if (runs == 0 && FLAGS_ms < 1000) {
// Run the first bench for 1000ms to warm up the nanobench if FLAGS_ms < 1000.
// Otherwise, the first few benches' measurements will be inaccurate.
@@ -1326,12 +1332,6 @@
write_canvas_png(target, pngFilename);
}
- if (kFailedLoops == loops) {
- // Can't be timed. A warning note has already been printed.
- cleanup_run(target);
- continue;
- }
-
Stats stats(samples);
log->config(config);
log->configOption("name", bench->getName());