git.delta.rocks / unique-network / refs/commits / eebd5d8677d8

difftreelog

source

.maintain/frame-weight-template.hbs3.5 KiBsourcehistory
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//! 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)]17#![allow(clippy::unnecessary_cast)]1819use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};20use sp_std::marker::PhantomData;2122/// Weight functions needed for {{pallet}}.23pub trait WeightInfo {24	{{~#each benchmarks as |benchmark|}}25	fn {{benchmark.name~}}26	(27		{{~#each benchmark.components as |c| ~}}28		{{c.name}}: u32, {{/each~}}29	) -> Weight;30	{{~/each}}31}3233/// Weights for {{pallet}} using the Substrate node and recommended hardware.34pub struct SubstrateWeight<T>(PhantomData<T>);35impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {36	{{~#each benchmarks as |benchmark|}}37	{{~#each benchmark.comments as |comment|}}38	// {{comment}}39	{{~/each}}40	fn {{benchmark.name~}}41	(42		{{~#each benchmark.components as |c| ~}}43		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}44	) -> Weight {45		({{underscore benchmark.base_weight}} as Weight)46			{{~#each benchmark.component_weight as |cw|}}47			// Standard Error: {{underscore cw.error}}48			.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))49			{{~/each}}50			{{~#if (ne benchmark.base_reads "0")}}51			.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))52			{{~/if}}53			{{~#each benchmark.component_reads as |cr|}}54			.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))55			{{~/each}}56			{{~#if (ne benchmark.base_writes "0")}}57			.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))58			{{~/if}}59			{{~#each benchmark.component_writes as |cw|}}60			.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))61			{{~/each}}62	}63	{{~/each}}64}6566// For backwards compatibility and tests67impl WeightInfo for () {68	{{~#each benchmarks as |benchmark|}}69	{{~#each benchmark.comments as |comment|}}70	// {{comment}}71	{{~/each}}72	fn {{benchmark.name~}}73	(74		{{~#each benchmark.components as |c| ~}}75		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}76	) -> Weight {77		({{underscore benchmark.base_weight}} as Weight)78			{{~#each benchmark.component_weight as |cw|}}79			// Standard Error: {{underscore cw.error}}80			.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))81			{{~/each}}82			{{~#if (ne benchmark.base_reads "0")}}83			.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))84			{{~/if}}85			{{~#each benchmark.component_reads as |cr|}}86			.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))87			{{~/each}}88			{{~#if (ne benchmark.base_writes "0")}}89			.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))90			{{~/if}}91			{{~#each benchmark.component_writes as |cw|}}92			.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))93			{{~/each}}94	}95	{{~/each}}96}