]> git.sesse.net Git - stockfish/blobdiff - src/benchmark.cpp
Introduce and use wait_for_search_finished()
[stockfish] / src / benchmark.cpp
index b43f0ee527392af234c9490e96ca2e560a3d40a5..9f0ac0c145b220798eaab1449e8b848f3c411b94 100644 (file)
@@ -28,7 +28,6 @@
 #include "ucioption.h"
 
 using namespace std;
-using namespace Search;
 
 static const char* Defaults[] = {
   "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
@@ -61,8 +60,7 @@ static const char* Defaults[] = {
 void benchmark(int argc, char* argv[]) {
 
   vector<string> fens;
-  LimitsType limits;
-  int time;
+  Search::LimitsType limits;
   int64_t nodes = 0;
 
   // Assign default values to missing arguments
@@ -74,7 +72,6 @@ void benchmark(int argc, char* argv[]) {
 
   Options["Hash"]    = ttSize;
   Options["Threads"] = threads;
-  Options["OwnBook"] = false;
 
   if (valType == "time")
       limits.maxTime = 1000 * atoi(valStr.c_str()); // maxTime is in ms
@@ -105,7 +102,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++)
   {
@@ -115,21 +112,21 @@ void benchmark(int argc, char* argv[]) {
 
       if (valType == "perft")
       {
-          int64_t cnt = perft(pos, limits.maxDepth * ONE_PLY);
+          int64_t cnt = Search::perft(pos, limits.maxDepth * ONE_PLY);
           cerr << "\nPerft " << limits.maxDepth  << " leaf nodes: " << cnt << endl;
           nodes += cnt;
       }
       else
       {
-          Threads.start_thinking(pos, limits, vector<Move>(), false);
-          nodes += RootPosition.nodes_searched();
+          Threads.start_searching(pos, limits);
+          nodes += Search::RootPosition.nodes_searched();
       }
   }
 
-  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;
 }