Only report success rate and average time in benchmark summary

This commit is contained in:
Camden Dixie O'Brien 2022-11-23 15:23:11 +00:00
parent 14eb8533e6
commit 07c1fc7a0f

22
main.c
View File

@ -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;
}