-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathrun_benches_for_runtime.sh
More file actions
executable file
·103 lines (90 loc) · 2.39 KB
/
Copy pathrun_benches_for_runtime.sh
File metadata and controls
executable file
·103 lines (90 loc) · 2.39 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -x
# Runs all benchmarks for all pallets, for a given runtime, provided by $1
# Should be run on a reference machine to gain accurate benchmarks
# current Substrate reference machine: https://github.com/paritytech/substrate/pull/5848
runtime=${1-"peregrine"}
profile=${2-"release"}
# Dev profile is the debug target
standard_args="--profile $profile --locked --features=runtime-benchmarks --package $runtime-runtime"
pallets=(
pallet-migration
attestation
ctype
delegation
did
frame-system
pallet-balances
pallet-democracy
pallet-indices
pallet-inflation
pallet-preimage
pallet-proxy
pallet-scheduler
pallet-session
pallet-timestamp
pallet-tips
pallet-treasury
pallet-utility
pallet-vesting
pallet-xcm
parachain-staking
public-credentials
pallet-deposit-storage
pallet-dip-provider
pallet-message-queue
cumulus-pallet-parachain-system
pallet_multisig
pallet-assets
pallet-asset-switch
# `pallet-membership` instances
pallet-membership
pallet-technical-membership
pallet-collators
# `pallet-collective` instances
pallet-collective
pallet-technical-committee-collective
# `pallet-did-lookup` instances
pallet-did-lookup
# `pallet-web3-names` instances
pallet-web3-names
# ISMP
ismp-parachain
pallet-token-gateway
)
# Add Peregrine-only pallets here!
if [ "$runtime" = "peregrine" ]; then
pallets+=(
pallet-sudo
pallet-bonded-assets
pallet-bonded-coins
)
fi
echo "[+] Running all runtime benchmarks for \"$runtime\", and profile \"$profile\""
cargo build $standard_args
if [ "$profile" = "dev" ]; then
target_folder="debug"
file_extension=".wasm"
# We care about benchmark correctness, not accuracy.
additional_args="--steps=2 --repeat=1 --default-pov-mode=ignored"
else
target_folder=$profile
file_extension=".compact.compressed.wasm"
additional_args="--header=HEADER-GPL --template=.maintain/runtime-weight-template.hbs --output=./runtimes/${runtime}/src/weights/"
fi
wasm_path="./target/$target_folder/wbuild/$runtime-runtime/${runtime}_runtime$file_extension"
for pallet in "${pallets[@]}"; do
echo "Runtime: $runtime. Pallet: $pallet"
# shellcheck disable=SC2086
frame-omni-bencher v1 benchmark pallet \
--pallet="$pallet" \
--extrinsic="*" \
--genesis-builder="runtime" \
--runtime=$wasm_path \
$additional_args
bench_status=$?
# Exit with error as soon as one benchmark fails
if [ $bench_status -ne 0 ]; then
exit $bench_status
fi
done