This commit is contained in:
Siarhei Fedartsou 2024-06-07 21:04:10 +02:00
parent c0713dc9f0
commit 201efdd0ca
2 changed files with 12 additions and 6 deletions

View File

@ -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)}")

View File

@ -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