difftreelog
feat benchmarking script
in: master
3 files changed
.maintain/frame-weight-template.hbsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for {{pallet}}4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}6//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`7//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}89// Executed Command:10{{#each args as |arg|~}}11// {{arg}}12{{/each}}1314#![cfg_attr(rustfmt, rustfmt_skip)]15#![allow(unused_parens)]16#![allow(unused_imports)]1718use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};19use sp_std::marker::PhantomData;2021/// Weight functions needed for {{pallet}}.22pub trait WeightInfo {23 {{~#each benchmarks as |benchmark|}}24 fn {{benchmark.name~}}25 (26 {{~#each benchmark.components as |c| ~}}27 {{c.name}}: u32, {{/each~}}28 ) -> Weight;29 {{~/each}}30}3132/// Weights for {{pallet}} using the Substrate node and recommended hardware.33pub struct SubstrateWeight<T>(PhantomData<T>);34impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {35 {{~#each benchmarks as |benchmark|}}36 {{~#each benchmark.comments as |comment|}}37 // {{comment}}38 {{~/each}}39 fn {{benchmark.name~}}40 (41 {{~#each benchmark.components as |c| ~}}42 {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}43 ) -> Weight {44 ({{underscore benchmark.base_weight}} as Weight)45 {{~#each benchmark.component_weight as |cw|}}46 // Standard Error: {{underscore cw.error}}47 .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))48 {{~/each}}49 {{~#if (ne benchmark.base_reads "0")}}50 .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))51 {{~/if}}52 {{~#each benchmark.component_reads as |cr|}}53 .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))54 {{~/each}}55 {{~#if (ne benchmark.base_writes "0")}}56 .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))57 {{~/if}}58 {{~#each benchmark.component_writes as |cw|}}59 .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))60 {{~/each}}61 }62 {{~/each}}63}6465// For backwards compatibility and tests66impl WeightInfo for () {67 {{~#each benchmarks as |benchmark|}}68 {{~#each benchmark.comments as |comment|}}69 // {{comment}}70 {{~/each}}71 fn {{benchmark.name~}}72 (73 {{~#each benchmark.components as |c| ~}}74 {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}75 ) -> Weight {76 ({{underscore benchmark.base_weight}} as Weight)77 {{~#each benchmark.component_weight as |cw|}}78 // Standard Error: {{underscore cw.error}}79 .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))80 {{~/each}}81 {{~#if (ne benchmark.base_reads "0")}}82 .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))83 {{~/if}}84 {{~#each benchmark.component_reads as |cr|}}85 .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))86 {{~/each}}87 {{~#if (ne benchmark.base_writes "0")}}88 .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))89 {{~/if}}90 {{~#each benchmark.component_writes as |cw|}}91 .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))92 {{~/each}}93 }94 {{~/each}}95}Makefilediffbeforeafterboth--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+_bench:
+ cargo run --release --features runtime-benchmarks -- \
+ benchmark --pallet pallet-$(PALLET) \
+ --wasm-execution compiled --extrinsic '*' \
+ --template .maintain/frame-weight-template.hbs --steps=50 --repeat=20 \
+ --output=./pallets/$(PALLET)/src/weights.rs
+
+bench-evm-migration:
+ make _bench PALLET=evm-migration
+
+bench: bench-evm-migration
\ No newline at end of file
pallets/evm-migration/src/weights.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-migration/src/weights.rs
@@ -0,0 +1,80 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for pallet_evm_migration
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
+//! DATE: 2021-08-12, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
+
+// Executed Command:
+// target/release/nft
+// benchmark
+// --pallet
+// pallet-evm-migration
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
+// --steps=50
+// --repeat=20
+// --output=./pallets/evm-migration/src/weights.rs
+
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_evm_migration.
+pub trait WeightInfo {
+ fn begin() -> Weight;
+ fn set_data(b: u32, ) -> Weight;
+ fn finish(b: u32, ) -> Weight;
+}
+
+/// Weights for pallet_evm_migration using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ fn begin() -> Weight {
+ (6_210_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+ fn set_data(b: u32, ) -> Weight {
+ (2_926_000 as Weight)
+ // Standard Error: 4_000
+ .saturating_add((649_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+ }
+ fn finish(_b: u32, ) -> Weight {
+ (4_309_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ fn begin() -> Weight {
+ (6_210_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+ fn set_data(b: u32, ) -> Weight {
+ (2_926_000 as Weight)
+ // Standard Error: 4_000
+ .saturating_add((649_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+ }
+ fn finish(_b: u32, ) -> Weight {
+ (4_309_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
+ }
+}
\ No newline at end of file