Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions commands/bench/bench.cmd.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"runtime": { "label": "Runtime", "type_one_of": ["dev"] },
"pallet": { "label": "pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"target_dir": { "label": "Target Directory", "type_string": "substrate" },
"features": { "label": "AdditionalFeatures", "type_string": "riscv" }
"features": { "label": "AdditionalFeatures", "type_string": "riscv" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"polkadot-pallet": {
Expand All @@ -30,7 +31,8 @@
"runtime": { "label": "Runtime", "type_one_of": ["rococo", "westend"] },
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"target_dir": { "label": "Target Directory", "type_string": "polkadot" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-assets": {
Expand All @@ -42,7 +44,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "assets" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-collectives": {
Expand All @@ -54,7 +57,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "collectives" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-coretime": {
Expand All @@ -66,7 +70,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "coretime" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-bridge-hubs": {
Expand All @@ -78,7 +83,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "bridge-hubs" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-contracts": {
Expand All @@ -90,7 +96,8 @@
"runtime_dir": { "label": "Runtime Dir", "type_string": "contracts" },
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-glutton": {
Expand All @@ -102,7 +109,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "glutton" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-starters": {
Expand All @@ -114,7 +122,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "starters" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-people": {
Expand All @@ -126,7 +135,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "people" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
},
"cumulus-testing": {
Expand All @@ -138,7 +148,8 @@
"pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" },
"runtime_dir": { "label": "Runtime Dir", "type_string": "testing" },
"target_dir": { "label": "Target Directory", "type_string": "cumulus" },
"features": { "label": "Additional Features", "type_string": "" }
"features": { "label": "Additional Features", "type_string": "" },
"machine": { "label": "Machine", "type_string": "" }
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions commands/bench/lib/bench-pallet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ bench_pallet() {
get_arg optional --features "$@"
local additional_features="${out:-""}"

get_arg optional --machine "$@"
local machine="${out:-""}"

local features="runtime-benchmarks"
if [ -n "$additional_features" ]; then
features+=",$additional_features"
Expand Down Expand Up @@ -73,6 +76,10 @@ bench_pallet() {
die "Subcommand $subcommand is not supported for $target_dir in bench_pallet"
;;
esac

if [ -n "$machine" ]; then
$cargo_run_benchmarks --features="$features" -- benchmark machine --chain="$runtime" --allow-fail
fi
;;
polkadot)
# For backward compatibility: replace "-dev" with ""
Expand Down Expand Up @@ -106,6 +113,10 @@ bench_pallet() {
die "Subcommand $subcommand is not supported for $target_dir in bench_pallet"
;;
esac

if [ -n "$machine" ]; then
$cargo_run_benchmarks --bin=polkadot --features="$features" -- benchmark machine --chain="$runtime-dev" --allow-fail
fi
;;
cumulus)
get_arg required --runtime_dir "$@"
Expand Down Expand Up @@ -147,6 +158,10 @@ bench_pallet() {
die "Subcommand $subcommand is not supported for $target_dir in bench_pallet"
;;
esac

if [ -n "$machine" ]; then
$cargo_run_benchmarks -p=polkadot-parachain-bin --features="$features" -- benchmark machine --chain="$chain" --allow-fail
fi
;;
*)
die "Repository $target_dir is not supported in bench_pallet"
Expand Down