From f4e725c8dc8334b7af0442b2a995dedf59796bde Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Mon, 8 Mar 2010 15:21:35 +0100 Subject: [PATCH] distributed engine: add debug info when not getting slave replies in time. --- distributed/distributed.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/distributed/distributed.c b/distributed/distributed.c index ac4b053..b0b45d7 100644 --- a/distributed/distributed.c +++ b/distributed/distributed.c @@ -316,6 +316,7 @@ update_cmd(struct board *b, char *cmd, char *args) static void get_replies(double time_limit, int min_playouts, struct board *b) { + double now; while (reply_count == 0 || reply_count < active_slaves) { if (time_limit && reply_count > 0) { struct timespec ts; @@ -327,16 +328,24 @@ get_replies(double time_limit, int min_playouts, struct board *b) pthread_cond_wait(&reply_cond, &slave_lock); } if (reply_count == 0) continue; - if (reply_count >= active_slaves) break; + if (reply_count >= active_slaves) return; if (time_limit) { - if (time_now() >= time_limit) break; + now = time_now(); + if (now >= time_limit) break; } else { int playouts, threads; struct move_stats s; select_best_move(b, &s, &playouts, &threads); - if (playouts >= min_playouts) break; + if (playouts >= min_playouts) return; } } + if (DEBUGL(1)) { + char buf[1024]; + snprintf(buf, sizeof(buf), + "get_replies timeout %.3f >= %.3f, replies %d < active %d\n", + now - start_time, time_limit - start_time, reply_count, active_slaves); + logline(NULL, "? ", buf); + } assert(reply_count > 0); } -- 2.11.4.GIT