File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -eou pipefail
3
3
4
+ function measure_peak_ram_and_time {
5
+ COMMAND=$1
6
+ OUTPUT_FILE=$2
7
+
8
+ OUTPUT=$( /usr/bin/time -f " %e %M" $COMMAND 2>&1 | tail -n 1)
9
+
10
+ TIME=$( echo $OUTPUT | awk ' {print $1}' )
11
+ PEAK_RAM_KB=$( echo $OUTPUT | awk ' {print $2}' )
12
+ PEAK_RAM_MB=$( echo " scale=2; $PEAK_RAM_KB / 1024" | bc)
13
+ echo " Time: ${TIME} s Peak RAM: ${PEAK_RAM_MB} MB" > $OUTPUT_FILE
14
+ }
15
+
4
16
function run_benchmarks_for_folder {
5
17
echo " Running benchmarks for $1 "
6
18
@@ -23,10 +35,11 @@ function run_benchmarks_for_folder {
23
35
BINARIES_FOLDER=" $FOLDER /build"
24
36
25
37
cp ~ /data.osm.pbf $FOLDER
26
- $BINARIES_FOLDER /osrm-extract -p $FOLDER /profiles/car.lua $FOLDER /data.osm.pbf
27
- $BINARIES_FOLDER /osrm-partition $FOLDER /data.osrm
28
- $BINARIES_FOLDER /osrm-customize $FOLDER /data.osrm
29
- $BINARIES_FOLDER /osrm-contract $FOLDER /data.osrm
38
+
39
+ measure_peak_ram_and_time " $BINARIES_FOLDER /osrm-extract -p $FOLDER /profiles/car.lua $FOLDER /data.osm.pbf" " $RESULTS_FOLDER /osrm_extract.bench"
40
+ measure_peak_ram_and_time " $BINARIES_FOLDER /osrm-partition $FOLDER /data.osrm" " $RESULTS_FOLDER /osrm_partition.bench"
41
+ measure_peak_ram_and_time " $BINARIES_FOLDER /osrm-customize $FOLDER /data.osrm" " $RESULTS_FOLDER /osrm_customize.bench"
42
+ measure_peak_ram_and_time " $BINARIES_FOLDER /osrm-contract $FOLDER /data.osrm" " $RESULTS_FOLDER /osrm_contract.bench"
30
43
31
44
if [ -f " $FOLDER /scripts/ci/locustfile.py" ]; then
32
45
for ALGORITHM in mld ch; do
You can’t perform that action at this time.
0 commit comments