X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbenchmark.cpp;h=136c6e80f5bc9ee7f4d86683194fc553e29f8c2d;hp=1491e222ea4b108bb726bdb557b7feae12349baa;hb=4124c94583c8f618738e4e357d86bc8579a5cde5;hpb=a29dd88f7563c5af871d9adc137218c39586b09c diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 1491e222..136c6e80 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include "misc.h" @@ -29,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", @@ -62,8 +60,7 @@ static const char* Defaults[] = { void benchmark(int argc, char* argv[]) { vector fens; - LimitsType limits; - int time; + Search::LimitsType limits; int64_t nodes = 0; // Assign default values to missing arguments @@ -75,16 +72,15 @@ 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 + limits.movetime = 1000 * atoi(valStr.c_str()); // movetime is in ms else if (valType == "nodes") - limits.maxNodes = atoi(valStr.c_str()); + limits.nodes = atoi(valStr.c_str()); else - limits.maxDepth = atoi(valStr.c_str()); + limits.depth = atoi(valStr.c_str()); if (fenFile != "default") { @@ -106,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++) { @@ -116,21 +112,22 @@ void benchmark(int argc, char* argv[]) { if (valType == "perft") { - int64_t cnt = perft(pos, limits.maxDepth * ONE_PLY); - cerr << "\nPerft " << limits.maxDepth << " leaf nodes: " << cnt << endl; + int64_t cnt = Search::perft(pos, limits.depth * ONE_PLY); + cerr << "\nPerft " << limits.depth << " leaf nodes: " << cnt << endl; nodes += cnt; } else { - Threads.start_thinking(pos, limits, set(), false); - nodes += RootPosition.nodes_searched(); + Threads.start_searching(pos, limits); + Threads.wait_for_search_finished(); + 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; }