Reported by Rein.
No functional change.
int64_t nodes = 0;
Search::StateStackPtr st;
- Time::point t = Time::now();
+ Time::point elapsed = Time::now();
for (size_t i = 0; i < fens.size(); i++)
{
}
}
- int e = Time::now() - t + 1; // Assure positive to avoid a 'divide by zero'
+ elapsed = Time::now() - elapsed + 1; // Assure positive to avoid a 'divide by zero'
cerr << "\n==========================="
- << "\nTotal time (ms) : " << e
+ << "\nTotal time (ms) : " << elapsed
<< "\nNodes searched : " << nodes
- << "\nNodes/second : " << 1000 * nodes / e << endl;
+ << "\nNodes/second : " << 1000 * nodes / elapsed << endl;
}
/// appended to the search log file. It uses the two helpers below to pretty
/// format time and score respectively.
-static string time_to_string(int millisecs) {
+static string time_to_string(int64_t msecs) {
const int MSecMinute = 1000 * 60;
const int MSecHour = 1000 * 60 * 60;
- int hours = millisecs / MSecHour;
- int minutes = (millisecs % MSecHour) / MSecMinute;
- int seconds = ((millisecs % MSecHour) % MSecMinute) / 1000;
+ int64_t hours = msecs / MSecHour;
+ int64_t minutes = (msecs % MSecHour) / MSecMinute;
+ int64_t seconds = ((msecs % MSecHour) % MSecMinute) / 1000;
stringstream s;
return s.str();
}
-string pretty_pv(Position& pos, int depth, Value value, int time, Move pv[]) {
+string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]) {
const int64_t K = 1000;
const int64_t M = 1000000;
s << setw(2) << depth
<< setw(8) << score_to_string(value)
- << setw(8) << time_to_string(time);
+ << setw(8) << time_to_string(msecs);
if (pos.nodes_searched() < M)
s << setw(8) << pos.nodes_searched() / 1 << " ";
Move move_from_uci(const Position& pos, std::string& str);
const std::string move_to_uci(Move m, bool chess960);
const std::string move_to_san(Position& pos, Move m);
-std::string pretty_pv(Position& pos, int depth, Value score, int time, Move pv[]);
+std::string pretty_pv(Position& pos, int depth, Value score, int64_t msecs, Move pv[]);
#endif // !defined(NOTATION_H_INCLUDED)
if (Options["Use Search Log"])
{
- int e = Time::now() - SearchTime;
+ Time::point elapsed = Time::now() - SearchTime + 1;
Log log(Options["Search Log Filename"]);
log << "Nodes: " << pos.nodes_searched()
- << "\nNodes/second: " << (e > 0 ? pos.nodes_searched() * 1000 / e : 0)
+ << "\nNodes/second: " << pos.nodes_searched() * 1000 / elapsed
<< "\nBest move: " << move_to_san(pos, RootMoves[0].pv[0]);
StateInfo st;
string uci_pv(const Position& pos, int depth, Value alpha, Value beta) {
std::stringstream s;
- int t = Time::now() - SearchTime;
+ Time::point elaspsed = Time::now() - SearchTime + 1;
int selDepth = 0;
for (size_t i = 0; i < Threads.size(); i++)
s << "\n";
s << "info depth " << d
- << " seldepth " << selDepth
- << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
- << " nodes " << pos.nodes_searched()
- << " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0)
- << " time " << t
- << " multipv " << i + 1
+ << " seldepth " << selDepth
+ << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
+ << " nodes " << pos.nodes_searched()
+ << " nps " << pos.nodes_searched() * 1000 / elaspsed
+ << " time " << elaspsed
+ << " multipv " << i + 1
<< " pv";
for (size_t j = 0; RootMoves[i].pv[j] != MOVE_NONE; j++)
if (Limits.ponder)
return;
- int e = Time::now() - SearchTime;
+ Time::point elapsed = Time::now() - SearchTime;
bool stillAtFirstMove = Signals.firstRootMove
&& !Signals.failedLowAtRoot
- && e > TimeMgr.available_time();
+ && elapsed > TimeMgr.available_time();
- bool noMoreTime = e > TimeMgr.maximum_time() - 2 * TimerResolution
+ bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerResolution
|| stillAtFirstMove;
if ( (Limits.use_time_management() && noMoreTime)
- || (Limits.movetime && e >= Limits.movetime))
+ || (Limits.movetime && elapsed >= Limits.movetime))
Signals.stop = true;
}