This commit is contained in:
Siarhei Fedartsou 2024-06-06 22:16:22 +02:00
parent 61225fc3f3
commit 50df983901
2 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from collections import defaultdict
import os
import csv
import numpy as np
import time
def main():
pass
@ -25,6 +26,8 @@ def main():
url = "http://localhost:5000"
times = []
for _ in range(10000):
start = random.choice(coordinates)
end = random.choice(coordinates)
@ -32,9 +35,15 @@ def main():
start_coord = f"{start[1]:.6f},{start[0]:.6f}"
end_coord = f"{end[1]:.6f},{end[0]:.6f}"
start_time = time.time()
response = requests.get(f"{url}/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true")
end_time = time.time()
if response.status_code != 200:
raise Exception(f"Error: {response.status_code} {response.text}")
times.append(end_time - start_time)
print(f"Mean time: {np.mean(times)}")

View File

@ -47,7 +47,7 @@ function run_benchmarks_for_folder {
# python3 $FOLDER/scripts/ci/process_locust_benchmark_results.py locust_results_$ALGORITHM $ALGORITHM $RESULTS_FOLDER
python3 $LOCUSTFILE_FOLDER/scripts/ci/e2e_benchmark.py
python3 $LOCUSTFILE_FOLDER/scripts/ci/e2e_benchmark.py > $RESULTS_FOLDER/e2e_$ALGORITHM.bench
kill -0 $OSRM_ROUTED_PID