forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks-ci.sh
executable file
·52 lines (46 loc) · 1.38 KB
/
benchmarks-ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
category=$1
runtimeName=$2
artifactsDir=$3
steps=${4:-50}
repeat=${5:-20}
benchmarkOutput=./parachains/runtimes/$category/$runtimeName/src/weights
benchmarkRuntimeName="$runtimeName-dev"
if [ $category = "glutton" ]; then
benchmarkRuntimeName="$runtimeName-dev-1300"
fi
# Load all pallet names in an array.
pallets=($(
${artifactsDir}/polkadot-parachain benchmark pallet --list --chain="${benchmarkRuntimeName}" |\
tail -n+2 |\
cut -d',' -f1 |\
sort |\
uniq
))
if [ ${#pallets[@]} -ne 0 ]; then
echo "[+] Benchmarking ${#pallets[@]} pallets for runtime $runtime"
else
echo "$runtimeName pallet list not found in benchmarks-ci.sh"
exit 1
fi
for pallet in ${pallets[@]}
do
output_dir=""
extra_args=""
# a little hack for pallet_xcm_benchmarks - we want to force custom implementation for XcmWeightInfo
if [[ "$pallet" == "pallet_xcm_benchmarks::generic" ]] || [[ "$pallet" == "pallet_xcm_benchmarks::fungible" ]]; then
output_dir="xcm/"
extra_args="--template=./templates/xcm-bench-template.hbs"
fi
$artifactsDir/polkadot-parachain benchmark pallet \
$extra_args \
--chain=$benchmarkRuntimeName \
--wasm-execution=compiled \
--pallet=$pallet \
--extrinsic='*' \
--steps=$steps \
--repeat=$repeat \
--json \
--header=./file_header.txt \
--output="${benchmarkOutput}/${output_dir}" >> $artifactsDir/${pallet}_benchmark.json
done