Skip to content

Commit

Permalink
Merge pull request #79 from paritytech/oty-enable-instance-benchmarking
Browse files Browse the repository at this point in the history
Just pass a folder to `benchmark pallet --output`
  • Loading branch information
ggwpez authored Sep 23, 2022
2 parents 5c07032 + 9ecc060 commit fc5ca1d
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions bench-bot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ shopt -s inherit_errexit
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
. "$(dirname "${BASH_SOURCE[0]}")/cmd_runner.sh"

cargo_run_benchmarks="cargo +nightly run --quiet --profile=production"
cargo_run_benchmarks="cargo +nightly run --locked --quiet --profile=production"
repository="$(basename "$PWD")"

bench_pallet_common_args=(
Expand Down Expand Up @@ -94,23 +94,17 @@ bench_pallet() {
fi
local weights_dir="./runtime/${runtime_dir}/src/weights"

local output_file=""
if [[ $pallet == *"::"* ]]; then
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
output_file="${pallet//::/_}.rs"
fi

case "$kind" in
runtime)
args+=(
--header=./file_header.txt
--output="${weights_dir}/${output_file}"
--output="${weights_dir}/"
)
;;
xcm)
args+=(
--template=./xcm/pallet-xcm-benchmarks/template.hbs
--output="${weights_dir}/xcm/${output_file}"
--output="${weights_dir}/xcm/"
)
;;
*)
Expand All @@ -132,23 +126,17 @@ bench_pallet() {
--header=./file_header.txt
)

local output_file=""
if [[ $pallet == *"::"* ]]; then
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
output_file="${pallet//::/_}.rs"
fi

case "$kind" in
pallet)
args+=(
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/${output_file}"
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/"
)
;;
xcm)
mkdir -p "./parachains/runtimes/$chain_type/$runtime/src/weights/xcm"
args+=(
--template=./templates/xcm-bench-template.hbs
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/xcm/${output_file}"
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/xcm/"
)
;;
*)
Expand Down

0 comments on commit fc5ca1d

Please sign in to comment.