int calls = 0; int found = 0; int notFound = 0; int totalLength = 0; std::vector listWalkDir; bool pathFound = false; Position position; FindPathParams fpp; fpp.fullPathSearch = true; fpp.clearSight = true; fpp.maxSearchDist = Map::maxViewportX + Map::maxViewportY; fpp.minTargetDist = 1; fpp.maxTargetDist = 1; std::chrono::high_resolution_clock::time_point time_start; std::chrono::high_resolution_clock::time_point time_end; uint64_t totalTime = 0; for (auto data : monsters) { listWalkDir.clear(); Monster* monster = data.second; for (int x = -10; x <= 10; x++) { for (int y = -10; y <= 10; y++) { if (x == 0 && y == 0) continue; position = monster->getPosition(); position.x += x; position.y += y; time_start = std::chrono::high_resolution_clock::now(); pathFound = monster->getPathTo(position, listWalkDir, fpp); time_end = std::chrono::high_resolution_clock::now(); totalTime += std::chrono::duration_cast(time_end - time_start).count(); ++calls; if (pathFound) { ++found; totalLength += listWalkDir.size(); } else { ++notFound; } } } } std::cout << fmt::format("Time: {:s} Calls: {:d} Found: {:d} Not found: {:d} Total length: {:d}", fmt::to_string(static_cast(totalTime) / 1000000.), calls, found, notFound, totalLength) << std::endl;