From 9610574f13a88bf3c01e595d62c447552bb1bd7f Mon Sep 17 00:00:00 2001 From: Roman Maslennikov Date: Mon, 26 Aug 2024 01:47:47 +0400 Subject: [PATCH] Test --- scripts/benchmarking/run_all_benchmarks.sh | 139 +++++++++++---------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/scripts/benchmarking/run_all_benchmarks.sh b/scripts/benchmarking/run_all_benchmarks.sh index 1060ec2ccdb..519d59e9d34 100755 --- a/scripts/benchmarking/run_all_benchmarks.sh +++ b/scripts/benchmarking/run_all_benchmarks.sh @@ -151,6 +151,8 @@ for PALLET in "${PALLETS[@]}"; do then TASKSET_CMD="taskset -c 2,3,4,5" echo "[+] Running pallet_gear_builtin benches on fixed 4 cores: 2,3,4,5" + else + TASKSET_CMD="taskset -c 8" fi # Get all the extrinsics for the pallet if the pallet is "pallet_gear". @@ -180,40 +182,39 @@ for PALLET in "${PALLETS[@]}"; do fi WEIGHT_FILE="./${WEIGHTS_OUTPUT}/${PALLET}.rs" - echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; + #echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; + + #OUTPUT=$( + # $TASKSET_CMD $GEAR benchmark pallet \ + # --chain="$chain_spec" \ + # --steps=$BENCHMARK_STEPS \ + # --repeat=$BENCHMARK_REPEAT \ + # --pallet="$PALLET" \ + # --extrinsic="$(IFS=, ; echo "${EXTRINSICS[*]}")" \ + # --heap-pages=4096 \ + # --output="$WEIGHT_FILE" \ + # --template=.maintain/frame-weight-template.hbs 2>&1 + #) + + #if [ $? -ne 0 ]; then + # echo "$OUTPUT" >> "$ERR_FILE" + # echo "[-] Failed to benchmark $PALLET. Error written to $ERR_FILE; continuing..." + #fi + + # If the pallet is pallet_gear, benchmark the one-time extrinsics. + if [ "$PALLET" == "pallet_gear" ] + then + echo "[+] MSquares Benchmarking $PALLET one-time syscalls with weight file ./${WEIGHTS_OUTPUT}/${PALLET}_onetime.rs"; - OUTPUT=$( $TASKSET_CMD $GEAR benchmark pallet \ --chain="$chain_spec" \ - --steps=$BENCHMARK_STEPS \ - --repeat=$BENCHMARK_REPEAT \ + --steps=$BENCHMARK_STEPS_ONE_TIME_EXTRINSICS \ + --repeat=$BENCHMARK_REPEAT_ONE_TIME_EXTRINSICS \ --pallet="$PALLET" \ - --extrinsic="$(IFS=, ; echo "${EXTRINSICS[*]}")" \ + --extrinsic="gr_exit" \ --heap-pages=4096 \ - --output="$WEIGHT_FILE" \ - --template=.maintain/frame-weight-template.hbs 2>&1 - ) - - if [ $? -ne 0 ]; then - echo "$OUTPUT" >> "$ERR_FILE" - echo "[-] Failed to benchmark $PALLET. Error written to $ERR_FILE; continuing..." - fi - - # If the pallet is pallet_gear, benchmark the one-time extrinsics. - if [ "$PALLET" == "pallet_gear" ] - then - echo "[+] Benchmarking $PALLET one-time syscalls with weight file ./${WEIGHTS_OUTPUT}/${PALLET}_onetime.rs"; - OUTPUT=$( - $TASKSET_CMD $GEAR benchmark pallet \ - --chain="$chain_spec" \ - --steps=$BENCHMARK_STEPS_ONE_TIME_EXTRINSICS \ - --repeat=$BENCHMARK_REPEAT_ONE_TIME_EXTRINSICS \ - --pallet="$PALLET" \ - --extrinsic="$(IFS=', '; echo "${ONE_TIME_EXTRINSICS[*]}")" \ - --heap-pages=4096 \ - --output="./${WEIGHTS_OUTPUT}/${PALLET}_onetime.rs" \ - --template=.maintain/frame-weight-template.hbs 2>&1 - ) + --json + #--output-analysis=min-squares if [ $? -ne 0 ]; then echo "$OUTPUT" >> "$ERR_FILE" @@ -222,43 +223,43 @@ for PALLET in "${PALLETS[@]}"; do fi done -if [ "$skip_machine_benchmark" != true ] -then - echo "[+] Benchmarking the machine..." - OUTPUT=$( - $TASKSET_CMD $GEAR benchmark machine --chain=$chain_spec --allow-fail 2>&1 - ) - # In any case don't write errors to the error file since they're not benchmarking errors. - echo "[x] Machine benchmark:\n$OUTPUT" - echo $OUTPUT >> $MACHINE_OUTPUT -fi - -# If `-s` is used, run the storage benchmark. -if [ ! -z "$storage_folder" ]; then - OUTPUT=$( - $TASKSET_CMD $GEAR benchmark storage \ - --chain=$chain_spec \ - --state-version=1 \ - --warmups=10 \ - --base-path=$storage_folder \ - --weight-path=./$STORAGE_OUTPUT 2>&1 - ) - if [ $? -ne 0 ]; then - echo "$OUTPUT" >> "$ERR_FILE" - echo "[-] Failed the storage benchmark. Error written to $ERR_FILE; continuing..." - fi -else - unset storage_folder -fi - -# Merge pallet_gear weights. -./scripts/benchmarking/merge_outputs.sh - -# Check if the error file exists. -if [ -f "$ERR_FILE" ]; then - echo "[-] Some benchmarks failed. See: $ERR_FILE" - exit 1 -else - echo "[+] All benchmarks passed." - exit 0 -fi +#if [ "$skip_machine_benchmark" != true ] +#then +# echo "[+] Benchmarking the machine..." +# OUTPUT=$( +# $TASKSET_CMD $GEAR benchmark machine --chain=$chain_spec --allow-fail 2>&1 +# ) +# # In any case don't write errors to the error file since they're not benchmarking errors. +# echo "[x] Machine benchmark:\n$OUTPUT" +# echo $OUTPUT >> $MACHINE_OUTPUT +#fi +# +## If `-s` is used, run the storage benchmark. +#if [ ! -z "$storage_folder" ]; then +# OUTPUT=$( +# $TASKSET_CMD $GEAR benchmark storage \ +# --chain=$chain_spec \ +# --state-version=1 \ +# --warmups=10 \ +# --base-path=$storage_folder \ +# --weight-path=./$STORAGE_OUTPUT 2>&1 +# ) +# if [ $? -ne 0 ]; then +# echo "$OUTPUT" >> "$ERR_FILE" +# echo "[-] Failed the storage benchmark. Error written to $ERR_FILE; continuing..." +# fi +#else +# unset storage_folder +#fi +# +## Merge pallet_gear weights. +#./scripts/benchmarking/merge_outputs.sh +# +## Check if the error file exists. +#if [ -f "$ERR_FILE" ]; then +# echo "[-] Some benchmarks failed. See: $ERR_FILE" +# exit 1 +#else +# echo "[+] All benchmarks passed." +# exit 0 +#fi