diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 509a7d08d9c..b29f1bb6de6 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -109,15 +109,6 @@ jobs: - name: Run all benchmarks run: | ./scripts/benchmarking/run_all_benchmarks.sh -c vara-dev -m - cp ./scripts/benchmarking/weights-output/* runtime/vara/src/weights - # apply some patches for `pallets/gear/src/weights.rs` - cp runtime/vara/src/weights/pallet_gear.rs pallets/gear/src/weights.rs - sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear/src/weights.rs - # apply some patches for `pallets/gear-builtin/src/weights.rs` - cp runtime/vara/src/weights/pallet_gear_builtin.rs pallets/gear-builtin/src/weights.rs - sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear-builtin/src/weights.rs - # generate code for lightweight scheduler that is used in gtest and other crates - ./scripts/weight-dump.sh - name: "ACTIONS: Upload artifact with benchmarking errors (if exist)" if: ${{ always() }} @@ -132,8 +123,8 @@ jobs: with: name: weights-vara path: | - runtime/vara/src/weights/ - utils/wasm-instrument/src/gas_metering/ + scripts/benchmarking/weights-output + - name: "TIP: download the artifacts and use `./scripts/unpack-weights.sh`" run: | diff --git a/.maintain/dump_weights.hbs b/.maintain/dump_weights.hbs new file mode 100644 index 00000000000..496b026ee81 --- /dev/null +++ b/.maintain/dump_weights.hbs @@ -0,0 +1,12 @@ +{ +{{#each benchmarks as |benchmark|}} + "{{benchmark.name}}": { + "base": {{benchmark.base_weight}}, + {{#each benchmark.component_weight as |cw|}} + "cw_slope": {{cw.slope}} + {{~#unless @last}},{{/unless}} + {{/each}} + } + {{~#unless @last}},{{/unless}} +{{/each}} +} diff --git a/scripts/benchmarking/run_all_benchmarks.sh b/scripts/benchmarking/run_all_benchmarks.sh index 40d2700dadc..7c4e550e217 100755 --- a/scripts/benchmarking/run_all_benchmarks.sh +++ b/scripts/benchmarking/run_all_benchmarks.sh @@ -151,7 +151,7 @@ for PALLET in "${PALLETS[@]}"; do EXTRINSICS=("*") fi - WEIGHT_FILE="./${WEIGHTS_OUTPUT}/${PALLET}.rs" + WEIGHT_FILE="./${WEIGHTS_OUTPUT}/${PALLET}.json" echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; OUTPUT=$( @@ -163,7 +163,7 @@ for PALLET in "${PALLETS[@]}"; do --extrinsic="$(IFS=, ; echo "${EXTRINSICS[*]}")" \ --heap-pages=4096 \ --output="$WEIGHT_FILE" \ - --template=.maintain/frame-weight-template.hbs 2>&1 + --template=.maintain/dump_weights.hbs 2>&1 ) if [ $? -ne 0 ]; then @@ -183,8 +183,8 @@ for PALLET in "${PALLETS[@]}"; do --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 + --output="./${WEIGHTS_OUTPUT}/${PALLET}_onetime.json" \ + --template=.maintain/dump_weights.hbs 2>&1 ) if [ $? -ne 0 ]; then @@ -224,7 +224,7 @@ else fi # Merge pallet_gear weights. -./scripts/benchmarking/merge_outputs.sh +#./scripts/benchmarking/merge_outputs.sh # Check if the error file exists. if [ -f "$ERR_FILE" ]; then