Send correct searched nodes statistic

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2010-12-31 18:18:23 +01:00
parent 9394db765f
commit df73af30dd
+14 -3
View File
@@ -267,6 +267,7 @@ namespace {
// Node counters, used only by thread[0] but try to keep in different cache // Node counters, used only by thread[0] but try to keep in different cache
// lines (64 bytes each) from the heavy multi-thread read accessed variables. // lines (64 bytes each) from the heavy multi-thread read accessed variables.
bool SendSearchedNodes;
int NodesSincePoll; int NodesSincePoll;
int NodesBetweenPolls = 30000; int NodesBetweenPolls = 30000;
@@ -401,7 +402,7 @@ bool think(Position& pos, bool infinite, bool ponder, int time[], int increment[
int movesToGo, int maxDepth, int maxNodes, int maxTime, Move searchMoves[]) { int movesToGo, int maxDepth, int maxNodes, int maxTime, Move searchMoves[]) {
// Initialize global search variables // Initialize global search variables
StopOnPonderhit = AbortSearch = Quit = AspirationFailLow = false; StopOnPonderhit = AbortSearch = Quit = AspirationFailLow = SendSearchedNodes = false;
NodesSincePoll = 0; NodesSincePoll = 0;
SearchStartTime = get_system_time(); SearchStartTime = get_system_time();
ExactMaxTime = maxTime; ExactMaxTime = maxTime;
@@ -721,6 +722,16 @@ namespace {
// Save the current node count before the move is searched // Save the current node count before the move is searched
nodes = pos.nodes_searched(); nodes = pos.nodes_searched();
// If it's time to send nodes info, do it here where we have the
// correct accumulated node counts searched by each thread.
if (SendSearchedNodes)
{
SendSearchedNodes = false;
cout << "info nodes " << nodes
<< " nps " << nps(pos)
<< " time " << current_search_time() << endl;
}
// Pick the next root move, and print the move and the move number to // Pick the next root move, and print the move and the move number to
// the standard output. // the standard output.
move = ss->currentMove = rml[i].pv[0]; move = ss->currentMove = rml[i].pv[0];
@@ -2007,8 +2018,8 @@ split_point_start: // At split points actual search starts from here
if (dbg_show_hit_rate) if (dbg_show_hit_rate)
dbg_print_hit_rate(); dbg_print_hit_rate();
cout << "info nodes " << pos.nodes_searched() << " nps " << nps(pos) // Send info on searched nodes as soon as we return to root
<< " time " << t << endl; SendSearchedNodes = true;
} }
// Should we stop the search? // Should we stop the search?