perft-test: output also SF perf
This commit is contained in:
@@ -238,13 +238,13 @@ int main(int __unused ac, __unused char**av)
|
|||||||
pos_t *pos = NULL, *fenpos;
|
pos_t *pos = NULL, *fenpos;
|
||||||
pos_t *fishpos = pos_new();
|
pos_t *fishpos = pos_new();
|
||||||
movelist_t fishmoves;
|
movelist_t fishmoves;
|
||||||
//move_t move;
|
|
||||||
FILE *outfd = NULL;
|
FILE *outfd = NULL;
|
||||||
struct {
|
struct {
|
||||||
s64 count, ms;
|
s64 count, ms;
|
||||||
s64 minlps, maxlps;
|
s64 minlps, maxlps;
|
||||||
int skipped;
|
int skipped;
|
||||||
} res[2] = {
|
} res[3] = {
|
||||||
|
{ .minlps=LONG_MAX },
|
||||||
{ .minlps=LONG_MAX },
|
{ .minlps=LONG_MAX },
|
||||||
{ .minlps=LONG_MAX },
|
{ .minlps=LONG_MAX },
|
||||||
};
|
};
|
||||||
@@ -271,11 +271,9 @@ int main(int __unused ac, __unused char**av)
|
|||||||
return usage(*av);
|
return usage(*av);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (ac > 1)
|
|
||||||
// depth = atoi(av[1]);
|
printf("perft: depth = %d run = %x stockfish = %s\n",
|
||||||
//if (ac > 2)
|
depth, run, sf_run? "true": "false");
|
||||||
// run = atoi(av[2]) & 3;
|
|
||||||
printf("depth = %d run = %x sf = %s\n", depth, run, sf_run? "true": "false");
|
|
||||||
|
|
||||||
init_all();
|
init_all();
|
||||||
|
|
||||||
@@ -285,7 +283,7 @@ int main(int __unused ac, __unused char**av)
|
|||||||
if (sf_run)
|
if (sf_run)
|
||||||
outfd = open_stockfish();
|
outfd = open_stockfish();
|
||||||
|
|
||||||
CLOCK_DEFINE(clock, CLOCK_PROCESS);
|
CLOCK_DEFINE(clock, CLOCK_MONOTONIC);
|
||||||
while ((fen = next_fen(PERFT | MOVEDO))) {
|
while ((fen = next_fen(PERFT | MOVEDO))) {
|
||||||
test_line = cur_line();
|
test_line = cur_line();
|
||||||
if (!(fenpos = fen2pos(pos, fen))) {
|
if (!(fenpos = fen2pos(pos, fen))) {
|
||||||
@@ -293,10 +291,27 @@ int main(int __unused ac, __unused char**av)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pos = fenpos;
|
pos = fenpos;
|
||||||
if (sf_run)
|
if (sf_run) {
|
||||||
|
clock_start(&clock);
|
||||||
sf_count = send_stockfish_fen(outfd, fishpos, &fishmoves, fen, depth);
|
sf_count = send_stockfish_fen(outfd, fishpos, &fishmoves, fen, depth);
|
||||||
|
ms = clock_elapsed_ms(&clock);
|
||||||
// savepos = pos_dup(pos);
|
if (!ms) {
|
||||||
|
res[2].skipped++;
|
||||||
|
lps = 0;
|
||||||
|
} else {
|
||||||
|
lps = sf_count * 1000l / ms;
|
||||||
|
res[2].ms += ms;
|
||||||
|
res[2].count += sf_count;
|
||||||
|
if (lps > res[2].maxlps)
|
||||||
|
res[2].maxlps = lps;
|
||||||
|
if (lps < res[2].minlps)
|
||||||
|
res[2].minlps = lps;
|
||||||
|
}
|
||||||
|
printf("SF : line=%3d perft=%'lu %'ldms lps=%'lu \"%s\"\n",
|
||||||
|
test_line, sf_count, ms,
|
||||||
|
lps,
|
||||||
|
fen);
|
||||||
|
}
|
||||||
|
|
||||||
if (run & 1) {
|
if (run & 1) {
|
||||||
clock_start(&clock);
|
clock_start(&clock);
|
||||||
@@ -360,6 +375,15 @@ int main(int __unused ac, __unused char**av)
|
|||||||
// exit(0);
|
// exit(0);
|
||||||
}
|
}
|
||||||
pos_del(pos);
|
pos_del(pos);
|
||||||
|
if (sf_run) {
|
||||||
|
if (!res[2].ms)
|
||||||
|
res[2].ms = 1;
|
||||||
|
printf("total SF %'lums %'lums lps=%'lu min=%'lu max=%'lu (skipped %d)\n",
|
||||||
|
res[2].count, res[2].ms,
|
||||||
|
res[2].count * 1000l / res[2].ms,
|
||||||
|
res[2].minlps, res[2].maxlps,
|
||||||
|
res[2].skipped);
|
||||||
|
}
|
||||||
if (run & 1) {
|
if (run & 1) {
|
||||||
if (!res[0].ms)
|
if (!res[0].ms)
|
||||||
res[0].ms = 1;
|
res[0].ms = 1;
|
||||||
|
Reference in New Issue
Block a user