mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Rewrite time measurement code
Introduce and use a new Time class designed after QTime, from Qt framework. Should be a more clear and self documented code. As an added benefit we now use 64 bits internally to get millisecs from system time. This avoids to wrap around to 0 every 2^32 milliseconds, which is 49.71 days. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -61,7 +61,6 @@ void benchmark(int argc, char* argv[]) {
|
||||
|
||||
vector<string> fens;
|
||||
Search::LimitsType limits;
|
||||
int time;
|
||||
int64_t nodes = 0;
|
||||
|
||||
// Assign default values to missing arguments
|
||||
@@ -104,7 +103,7 @@ void benchmark(int argc, char* argv[]) {
|
||||
else
|
||||
fens.assign(Defaults, Defaults + 16);
|
||||
|
||||
time = system_time();
|
||||
Time time = Time::current_time();
|
||||
|
||||
for (size_t i = 0; i < fens.size(); i++)
|
||||
{
|
||||
@@ -125,10 +124,10 @@ void benchmark(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
time = system_time() - time;
|
||||
int e = time.elapsed();
|
||||
|
||||
cerr << "\n==========================="
|
||||
<< "\nTotal time (ms) : " << time
|
||||
<< "\nTotal time (ms) : " << e
|
||||
<< "\nNodes searched : " << nodes
|
||||
<< "\nNodes/second : " << int(nodes / (time / 1000.0)) << endl;
|
||||
<< "\nNodes/second : " << int(nodes / (e / 1000.0)) << endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user