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

difftreelog

source

.maintain/frame-weight-template.hbs3.7 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(missing_docs)]18#![allow(clippy::unnecessary_cast)]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	fn {{benchmark.name~}}46	(47		{{~#each benchmark.components as |c| ~}}48		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}49	) -> Weight {50		Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)51			{{#each benchmark.component_weight as |cw|}}52			// Standard Error: {{underscore cw.error}}53			.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as u64).saturating_mul({{cw.name}} as u64))54			{{/each}}55			{{#if (ne benchmark.base_reads "0")}}56			.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as u64))57			{{/if}}58			{{#each benchmark.component_reads as |cr|}}59			.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))60			{{/each}}61			{{#if (ne benchmark.base_writes "0")}}62			.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as u64))63			{{/if}}64			{{#each benchmark.component_writes as |cw|}}65			.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))66			{{/each}}67	}68	{{/each}}69}7071// For backwards compatibility and tests72impl WeightInfo for () {73	{{#each benchmarks as |benchmark|}}74	{{#each benchmark.comments as |comment|}}75	// {{comment}}76	{{/each}}77	fn {{benchmark.name~}}78	(79		{{~#each benchmark.components as |c| ~}}80		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}81	) -> Weight {82		Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)83			{{#each benchmark.component_weight as |cw|}}84			// Standard Error: {{underscore cw.error}}85			.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as u64).saturating_mul({{cw.name}} as u64))86			{{/each}}87			{{#if (ne benchmark.base_reads "0")}}88			.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as u64))89			{{/if}}90			{{#each benchmark.component_reads as |cr|}}91			.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))92			{{/each}}93			{{#if (ne benchmark.base_writes "0")}}94			.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as u64))95			{{/if}}96			{{#each benchmark.component_writes as |cw|}}97			.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))98			{{/each}}99	}100	{{/each}}101}