From b30d11319bac8bb7a528b6da5ddd13ac9db26996 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 2 Oct 2017 09:48:15 -0400 Subject: 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 Commit-Queue: Leon Scroggins --- bench/nanobench.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bench/nanobench.cpp') diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 04583309ce..61de8a944e 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -1284,6 +1284,12 @@ int main(int argc, char** argv) { ? 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 @@ int main(int argc, char** argv) { 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()); -- cgit v1.2.3