1// 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//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`8//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`9//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}1011// Executed Command:12{{#each args as |arg|}}13// {{arg}}14{{/each}}1516#![cfg_attr(rustfmt, rustfmt_skip)]17#![allow(unused_parens)]18#![allow(unused_imports)]1920use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};21use sp_std::marker::PhantomData;2223/// Weight functions needed for {{pallet}}.24pub trait WeightInfo {25 {{#each benchmarks as |benchmark|}}26 fn {{benchmark.name~}}27 (28 {{~#each benchmark.components as |c| ~}}29 {{c.name}}: u32, {{/each~}}30 ) -> Weight;31 {{/each}}32}3334/// Weights for {{pallet}} using the Substrate node and recommended hardware.35pub struct SubstrateWeight<T>(PhantomData<T>);36{{#if (eq pallet "frame_system")}}37impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {38{{else}}39impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {40{{/if}}41 {{#each benchmarks as |benchmark|}}42 {{#each benchmark.comments as |comment|}}43 /// {{comment}}44 {{/each}}45 {{#each benchmark.component_ranges as |range|}}46 /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.47 {{/each}}48 fn {{benchmark.name~}}49 (50 {{~#each benchmark.components as |c| ~}}51 {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}52 ) -> Weight {53 // Proof Size summary in bytes:54 // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`55 // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`56 // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.57 Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})58 {{#each benchmark.component_weight as |cw|}}59 // Standard Error: {{underscore cw.error}}60 .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))61 {{/each}}62 {{#if (ne benchmark.base_reads "0")}}63 .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))64 {{/if}}65 {{#each benchmark.component_reads as |cr|}}66 .saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))67 {{/each}}68 {{#if (ne benchmark.base_writes "0")}}69 .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))70 {{/if}}71 {{#each benchmark.component_writes as |cw|}}72 .saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))73 {{/each}}74 {{#each benchmark.component_calculated_proof_size as |cp|}}75 .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))76 {{/each}}77 }78 {{/each}}79}8081// For backwards compatibility and tests82impl WeightInfo for () {83 {{#each benchmarks as |benchmark|}}84 {{#each benchmark.comments as |comment|}}85 /// {{comment}}86 {{/each}}87 {{#each benchmark.component_ranges as |range|}}88 /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.89 {{/each}}90 fn {{benchmark.name~}}91 (92 {{~#each benchmark.components as |c| ~}}93 {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}94 ) -> Weight {95 // Proof Size summary in bytes:96 // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`97 // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`98 // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.99 Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})100 {{#each benchmark.component_weight as |cw|}}101 // Standard Error: {{underscore cw.error}}102 .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))103 {{/each}}104 {{#if (ne benchmark.base_reads "0")}}105 .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))106 {{/if}}107 {{#each benchmark.component_reads as |cr|}}108 .saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))109 {{/each}}110 {{#if (ne benchmark.base_writes "0")}}111 .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))112 {{/if}}113 {{#each benchmark.component_writes as |cw|}}114 .saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))115 {{/each}}116 {{#each benchmark.component_calculated_proof_size as |cp|}}117 .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))118 {{/each}}119 }120 {{/each}}121}122