benchmarking-cli: add --list-pallets and --all options (#3395)

closes #2844 

- adds `list-pallets` option which prints all unique available pallets
for benchmarking
```bash
./target/release/node benchmark pallet --list=pallets
```
- adds `all` option which runs benchmarks for all available pallets and
extrinsics (equivalent to `--pallet * --extrinsic *`)
```bash
./target/release/node benchmark pallet --all
```

- use the `list=pallets` syntax in `run_all_benchmarks.sh` script

cc ggwpez

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Dastan
2024-02-21 15:56:09 +01:00
committed by GitHub
parent 5a06771ecc
commit 165d075a5f
4 changed files with 86 additions and 25 deletions
+4 -7
View File
@@ -59,11 +59,12 @@ done
if [ "$skip_build" != true ]
then
echo "[+] Compiling Substrate benchmarks..."
cargo build --profile=production --locked --features=runtime-benchmarks --bin substrate
cargo build --profile=production --locked --features=runtime-benchmarks --bin substrate-node
fi
# The executable to use.
SUBSTRATE=./target/production/substrate
# Parent directory because of the monorepo structure.
SUBSTRATE=../target/production/substrate-node
# Manually exclude some pallets.
EXCLUDED_PALLETS=(
@@ -80,11 +81,7 @@ EXCLUDED_PALLETS=(
# Load all pallet names in an array.
ALL_PALLETS=($(
$SUBSTRATE benchmark pallet --list --chain=dev |\
tail -n+2 |\
cut -d',' -f1 |\
sort |\
uniq
$SUBSTRATE benchmark pallet --list=pallets --no-csv-header --chain=dev
))
# Filter out the excluded pallets by concatenating the arrays and discarding duplicates.