From 019738c7ce89a4d704975b7bc16de2c1286fd1b4 Mon Sep 17 00:00:00 2001 From: CalciteM Date: Sat, 7 Sep 2019 20:21:47 +0800 Subject: [PATCH] =?UTF-8?q?search:=20QTime=20=E6=9B=BF=E6=8D=A2=E4=B8=BA?= =?UTF-8?q?=20chrono=20=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai/search.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ai/search.cpp b/src/ai/search.cpp index 39e3407c..97244fd8 100644 --- a/src/ai/search.cpp +++ b/src/ai/search.cpp @@ -20,7 +20,6 @@ *****************************************************************************/ #include -#include #include #include #include @@ -680,7 +679,6 @@ MillGameAi_ab::value_t MillGameAi_ab::evaluate(Node *node) int MillGameAi_ab::alphaBetaPruning(depth_t depth) { - QTime time1; value_t value = 0; depth_t d = changeDepth(depth); @@ -688,7 +686,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth) time_t time0 = time(nullptr); srand(static_cast(time0)); - time1.start(); + chrono::steady_clock::time_point timeStart = chrono::steady_clock::now(); + chrono::steady_clock::time_point timeEnd; #ifdef BOOK_LEARNING if (chess_.getStage() == MillGame::GAME_PLACING) @@ -739,7 +738,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth) alphaBetaPruning(i, -INF_VALUE, INF_VALUE, rootNode); } - loggerDebug("IDS Time: %0.3fs\n", time1.elapsed() / 1000.0); + timeEnd = chrono::steady_clock::now(); + loggerDebug("IDS Time: %llus\n", chrono::duration_cast(timeEnd - timeStart).count()); #endif /* IDS_SUPPORT */ #ifdef HASH_MAP_ENABLE @@ -750,7 +750,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth) value = alphaBetaPruning(d, -INF_VALUE /* alpha */, INF_VALUE /* beta */, rootNode); - loggerDebug("Total Time: %0.3fs\n", time1.elapsed() / 1000.0); + timeEnd = chrono::steady_clock::now(); + loggerDebug("Total Time: %llus\n", chrono::duration_cast(timeEnd - timeStart).count()); // η”ŸζˆδΊ† Alpha-Beta ζ ‘