From 07c1fc7a0fe792ad0fd28b013cc765d8546dd5cb Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Wed, 23 Nov 2022 15:23:11 +0000 Subject: [PATCH] Only report success rate and average time in benchmark summary --- main.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/main.c b/main.c index 1707aa9..f7a2efd 100644 --- a/main.c +++ b/main.c @@ -84,31 +84,15 @@ int main(void) const double tot_micros = 1e6 * (double)secs + (double)nanos / 1e3; const double avg_micros = tot_micros / NPUZZLES; - unsigned error = 0, incomplete = 0, incorrect = 0, solved = 0; + unsigned solved = 0; for (i = 0; i < NPUZZLES; ++i) { - if (!res[i]) { - ++error; - continue; - } - switch (check(&puzzles[i])) { - case INCOMPLETE: - ++incomplete; - break; - case INCORRECT: - ++incorrect; - break; - case SOLVED: + if (res[i] && check(&puzzles[i]) == SOLVED) ++solved; - break; - } } puts("\n SUMMARY\n ======="); + printf("Success rate: %.0lf%%\n", 1e2 * (double)solved / NPUZZLES); printf("Average time: %.3lf µs\n", avg_micros); - printf("Solved: %4u/%u\n", solved, NPUZZLES); - printf("Incomplete: %4u/%u\n", incomplete, NPUZZLES); - printf("Incorrect: %4u/%u\n", incorrect, NPUZZLES); - printf("Solver error: %4u/%u\n", error, NPUZZLES); return 0; }