From 0d0fd88acf26eb3e35e3c240dbdd75ac4444153b Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Wed, 5 Jun 2024 21:44:07 +0200 Subject: [PATCH 01/10] Add simple benchmarks for osrm-* tools --- scripts/ci/run_benchmarks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 51ced3d5312..38205bea282 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -24,7 +24,7 @@ function run_benchmarks_for_folder { cp ~/data.osm.pbf $FOLDER $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf - $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm + time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm > "$RESULTS_FOLDER/osrm_partition.bench" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm From 9f4537b81487a463c834a0aae6251ef8eb1ca670 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Wed, 5 Jun 2024 22:08:45 +0200 Subject: [PATCH 02/10] Add simple benchmarks for osrm-* tools --- scripts/ci/run_benchmarks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 38205bea282..767410de3a1 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -24,7 +24,7 @@ function run_benchmarks_for_folder { cp ~/data.osm.pbf $FOLDER $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf - time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm > "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm > "$RESULTS_FOLDER/osrm_partition.bench" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm From 8a1d9fd16312643a155eed84f5e407434cec4487 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 08:58:32 +0200 Subject: [PATCH 03/10] wip --- scripts/ci/run_benchmarks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 767410de3a1..7b4521e7225 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -24,7 +24,7 @@ function run_benchmarks_for_folder { cp ~/data.osm.pbf $FOLDER $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf - /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm > "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm >2 "$RESULTS_FOLDER/osrm_partition.bench" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm From b10df9e7701fd5780b03580a9aa1040c19b96649 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 09:16:53 +0200 Subject: [PATCH 04/10] wip --- scripts/ci/run_benchmarks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 7b4521e7225..cea25394120 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -24,7 +24,7 @@ function run_benchmarks_for_folder { cp ~/data.osm.pbf $FOLDER $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf - /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm >2 "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_partition.bench" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm From e35db36cad1a44f812532178d8679aa209cf9236 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 10:01:18 +0200 Subject: [PATCH 05/10] wip --- scripts/ci/run_benchmarks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index cea25394120..96e905c6216 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -23,10 +23,10 @@ function run_benchmarks_for_folder { BINARIES_FOLDER="$FOLDER/build" cp ~/data.osm.pbf $FOLDER - $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf - /usr/bin/time -f "%M" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_partition.bench" - $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm - $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf 2> "$RESULTS_FOLDER/osrm_extract.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_customize.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_contract.bench" if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then for ALGORITHM in mld ch; do From ae69d460d8629fb6ba978915c438e8e6d307d812 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 10:25:28 +0200 Subject: [PATCH 06/10] wip --- scripts/ci/run_benchmarks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 96e905c6216..3280f207eff 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -23,10 +23,10 @@ function run_benchmarks_for_folder { BINARIES_FOLDER="$FOLDER/build" cp ~/data.osm.pbf $FOLDER - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf 2> "$RESULTS_FOLDER/osrm_extract.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_partition.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_customize.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm 2> "$RESULTS_FOLDER/osrm_contract.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf | tail -n 1 2> "$RESULTS_FOLDER/osrm_extract.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_customize.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_contract.bench" if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then for ALGORITHM in mld ch; do From 1ceb90dfe4d9848f8e3807a61254c222ddb5209c Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 10:57:37 +0200 Subject: [PATCH 07/10] wip --- scripts/ci/run_benchmarks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 3280f207eff..ec71a5a53e9 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -23,10 +23,10 @@ function run_benchmarks_for_folder { BINARIES_FOLDER="$FOLDER/build" cp ~/data.osm.pbf $FOLDER - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf | tail -n 1 2> "$RESULTS_FOLDER/osrm_extract.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_partition.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_customize.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm | tail -n 1 2> "$RESULTS_FOLDER/osrm_contract.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_extract.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_partition.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_customize.bench" + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_contract.bench" if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then for ALGORITHM in mld ch; do From 83e908bfcbc4e64b32ab8035cd70ae08b7bcd42a Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 11:22:02 +0200 Subject: [PATCH 08/10] wip --- scripts/ci/run_benchmarks.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index ec71a5a53e9..ed7b90c9264 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -1,6 +1,13 @@ #!/bin/bash set -eou pipefail +function measure_peak_ram_and_time { + COMMAND=$1 + OUTPUT_FILE=$2 + + /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $COMMAND 2>&1 | tail -n 1 > $OUTPUT_FILE +} + function run_benchmarks_for_folder { echo "Running benchmarks for $1" @@ -23,10 +30,11 @@ function run_benchmarks_for_folder { BINARIES_FOLDER="$FOLDER/build" cp ~/data.osm.pbf $FOLDER - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_extract.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_partition.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_customize.bench" - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm 2>&1 | tail -n 1 > "$RESULTS_FOLDER/osrm_contract.bench" + + measure_peak_ram_and_time "$BINARIES_FOLDER/osrm-extract -p $FOLDER/profiles/car.lua $FOLDER/data.osm.pbf" "$RESULTS_FOLDER/osrm_extract.bench" + measure_peak_ram_and_time "$BINARIES_FOLDER/osrm-partition $FOLDER/data.osrm" "$RESULTS_FOLDER/osrm_partition.bench" + measure_peak_ram_and_time "$BINARIES_FOLDER/osrm-customize $FOLDER/data.osrm" "$RESULTS_FOLDER/osrm_customize.bench" + measure_peak_ram_and_time "$BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm" "$RESULTS_FOLDER/osrm_contract.bench" if [ -f "$FOLDER/scripts/ci/locustfile.py" ]; then for ALGORITHM in mld ch; do From d917462a291fc0de76be0c14dc171cbb1b1e846e Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 11:55:06 +0200 Subject: [PATCH 09/10] wip --- scripts/ci/run_benchmarks.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index ed7b90c9264..2e3544241fa 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -5,7 +5,12 @@ function measure_peak_ram_and_time { COMMAND=$1 OUTPUT_FILE=$2 - /usr/bin/time -f "Time: %E Peak RAM: %M Kb" $COMMAND 2>&1 | tail -n 1 > $OUTPUT_FILE + OUTPUT=$(/usr/bin/time -f "%E %M" $COMMAND 2>&1 | tail -n 1) + + TIME=$(echo $OUTPUT | awk '{print $1}') + PEAK_RAM_KB=$(echo $OUTPUT | awk '{print $2}') + PEAK_RAM_MB=$(echo "scale=2; $PEAK_RAM_KB / 1024" | bc) + echo "Time: $TIME Peak RAM: $PEAK_RAM_MB MB" > $OUTPUT_FILE } function run_benchmarks_for_folder { From 29374c261344184996a215162d52d9db680a90f4 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 6 Jun 2024 12:19:53 +0200 Subject: [PATCH 10/10] wip --- scripts/ci/run_benchmarks.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 2e3544241fa..7b78ed66c65 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -5,12 +5,12 @@ function measure_peak_ram_and_time { COMMAND=$1 OUTPUT_FILE=$2 - OUTPUT=$(/usr/bin/time -f "%E %M" $COMMAND 2>&1 | tail -n 1) + OUTPUT=$(/usr/bin/time -f "%e %M" $COMMAND 2>&1 | tail -n 1) TIME=$(echo $OUTPUT | awk '{print $1}') PEAK_RAM_KB=$(echo $OUTPUT | awk '{print $2}') PEAK_RAM_MB=$(echo "scale=2; $PEAK_RAM_KB / 1024" | bc) - echo "Time: $TIME Peak RAM: $PEAK_RAM_MB MB" > $OUTPUT_FILE + echo "Time: ${TIME}s Peak RAM: ${PEAK_RAM_MB}MB" > $OUTPUT_FILE } function run_benchmarks_for_folder {