diff --git a/scripts/ci/e2e_benchmark.py b/scripts/ci/e2e_benchmark.py index 7c6b69cf8..6228cabfe 100644 --- a/scripts/ci/e2e_benchmark.py +++ b/scripts/ci/e2e_benchmark.py @@ -6,6 +6,7 @@ import os import csv import numpy as np import time +import argparse class BenchmarkRunner: def __init__(self): @@ -69,13 +70,17 @@ class BenchmarkRunner: raise Exception(f"Unknown benchmark: {benchmark_name}") def main(): - pass + parser = argparse.ArgumentParser(description='Run GPS benchmark tests.') + parser.add_argument('--host', type=str, required=True, help='Host URL') + parser.add_argument('--method', type=str, required=True, choices=['route', 'table', 'match', 'nearest', 'trip'], help='Benchmark method') + parser.add_argument('--num_requests', type=int, required=True, help='Number of requests to perform') + + args = parser.parse_args() random.seed(42) runner = BenchmarkRunner() - host = "http://localhost:5000" - times = runner.run('route', host, 10000) + times = runner.run(args.method, args.host, args.num_requests) print(f'Total: {np.sum(times)}') print(f"Min time: {np.min(times)}") @@ -86,4 +91,4 @@ def main(): print(f"Max time: {np.max(times)}") if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index b0ec8bde9..19bee9dba 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -60,8 +60,9 @@ 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 > $RESULTS_FOLDER/e2e_$ALGORITHM.bench - + for METHOD in route table nearest trip match; do + python3 $LOCUSTFILE_FOLDER/scripts/ci/e2e_benchmark.py --host http://localhost:5000 --method $METHOD --num_requests 10000 > $RESULTS_FOLDER/e2e_${METHOD}_${ALGORITHM}.bench + done kill -0 $OSRM_ROUTED_PID done