diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-26 17:37:55 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-26 18:04:44 +0100 |
commit | 590f120ced72b37eb6fd85b89e33a9d4b11c6f2c (patch) | |
tree | 8e94b775f09aef7c3095a1b686840527a1957ec9 /src/search-astar.cpp | |
parent | 0111a2f91caffc2d2b7d57c2d919c4d70f42db7f (diff) |
show more accurate timing info during pathfinding
Diffstat (limited to 'src/search-astar.cpp')
-rw-r--r-- | src/search-astar.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/search-astar.cpp b/src/search-astar.cpp index 40f19f44..76172840 100644 --- a/src/search-astar.cpp +++ b/src/search-astar.cpp @@ -179,7 +179,9 @@ path_search_result astar::Dijkstra(world& w, const point from, const point to, (void)debug; #endif - Timeline timeline; timeline.start(); + Timeline timeline; + if (debug > 0) [[unlikely]] + timeline.start(); clear(); auto& cache = *_cache; @@ -341,11 +343,11 @@ path_search_result astar::Dijkstra(world& w, const point from, const point to, auto d0 = (uint32_t)d0_.length(); char buf[128]; size_t len = 0; - const auto time = (uint32_t)Math::ceil(result.time() * 1e3f); + const auto time = result.time() * 1e3f; if (goal_idx != (uint32_t)-1) { auto d = nodes[goal_idx].dist; - len = snformat(buf, "Dijkstra: found in {} ms " + len = snformat(buf, "Dijkstra: found in {:.1f} ms " "len:{} len0:{} ratio:{:.4}\n"_cf, time, d, d0, d > 0 && d0 > 0 ? (float)d/(float)d0 : 1); @@ -354,7 +356,7 @@ path_search_result astar::Dijkstra(world& w, const point from, const point to, { const auto& closest = nodes[closest_idx]; fm_assert(closest.dist != 0 && closest.dist != (uint32_t)-1); - len = snformat(buf, "Dijkstra: no path found in {} ms " + len = snformat(buf, "Dijkstra: no path found in {:.1f} ms " "closest:{} len:{} len0:{} ratio:{:.4}\n"_cf, time, closest_dist, closest.dist, d0, d0 > 0 ? (float)closest.dist/(float)d0 : 1); |