|
| 1 | +{{header}} |
| 2 | +//! Autogenerated weights for `{{pallet}}` |
| 3 | +//! |
| 4 | +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} |
| 5 | +//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` |
| 6 | +//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}` |
| 7 | +//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` |
| 8 | +//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}` |
| 9 | + |
| 10 | +// Executed Command: |
| 11 | +{{#each args as |arg|}} |
| 12 | +// {{arg}} |
| 13 | +{{/each}} |
| 14 | + |
| 15 | +#![cfg_attr(rustfmt, rustfmt_skip)] |
| 16 | +#![allow(unused_parens)] |
| 17 | +#![allow(unused_imports)] |
| 18 | +#![allow(missing_docs)] |
| 19 | + |
| 20 | +use frame::weights_prelude::*; |
| 21 | + |
| 22 | +/// Weight functions needed for `{{pallet}}`. |
| 23 | +pub 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 | +} |
| 32 | + |
| 33 | +/// Weights for `{{pallet}}` using the Substrate node and recommended hardware. |
| 34 | +pub struct SubstrateWeight<T>(PhantomData<T>); |
| 35 | +{{#if (eq pallet "frame_system")}} |
| 36 | +impl<T: crate::Config> WeightInfo for SubstrateWeight<T> { |
| 37 | +{{else}} |
| 38 | +impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { |
| 39 | +{{/if}} |
| 40 | + {{#each benchmarks as |benchmark|}} |
| 41 | + {{#each benchmark.comments as |comment|}} |
| 42 | + /// {{comment}} |
| 43 | + {{/each}} |
| 44 | + {{#each benchmark.component_ranges as |range|}} |
| 45 | + /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. |
| 46 | + {{/each}} |
| 47 | + fn {{benchmark.name~}} |
| 48 | + ( |
| 49 | + {{~#each benchmark.components as |c| ~}} |
| 50 | + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} |
| 51 | + ) -> Weight { |
| 52 | + // Proof Size summary in bytes: |
| 53 | + // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` |
| 54 | + // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` |
| 55 | + // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds. |
| 56 | + Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) |
| 57 | + {{#each benchmark.component_weight as |cw|}} |
| 58 | + // Standard Error: {{underscore cw.error}} |
| 59 | + .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) |
| 60 | + {{/each}} |
| 61 | + {{#if (ne benchmark.base_reads "0")}} |
| 62 | + .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64)) |
| 63 | + {{/if}} |
| 64 | + {{#each benchmark.component_reads as |cr|}} |
| 65 | + .saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) |
| 66 | + {{/each}} |
| 67 | + {{#if (ne benchmark.base_writes "0")}} |
| 68 | + .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64)) |
| 69 | + {{/if}} |
| 70 | + {{#each benchmark.component_writes as |cw|}} |
| 71 | + .saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) |
| 72 | + {{/each}} |
| 73 | + {{#each benchmark.component_calculated_proof_size as |cp|}} |
| 74 | + .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into())) |
| 75 | + {{/each}} |
| 76 | + } |
| 77 | + {{/each}} |
| 78 | +} |
| 79 | + |
| 80 | +// For backwards compatibility and tests. |
| 81 | +impl WeightInfo for () { |
| 82 | + {{#each benchmarks as |benchmark|}} |
| 83 | + {{#each benchmark.comments as |comment|}} |
| 84 | + /// {{comment}} |
| 85 | + {{/each}} |
| 86 | + {{#each benchmark.component_ranges as |range|}} |
| 87 | + /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. |
| 88 | + {{/each}} |
| 89 | + fn {{benchmark.name~}} |
| 90 | + ( |
| 91 | + {{~#each benchmark.components as |c| ~}} |
| 92 | + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} |
| 93 | + ) -> Weight { |
| 94 | + // Proof Size summary in bytes: |
| 95 | + // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` |
| 96 | + // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` |
| 97 | + // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds. |
| 98 | + Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) |
| 99 | + {{#each benchmark.component_weight as |cw|}} |
| 100 | + // Standard Error: {{underscore cw.error}} |
| 101 | + .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) |
| 102 | + {{/each}} |
| 103 | + {{#if (ne benchmark.base_reads "0")}} |
| 104 | + .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64)) |
| 105 | + {{/if}} |
| 106 | + {{#each benchmark.component_reads as |cr|}} |
| 107 | + .saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) |
| 108 | + {{/each}} |
| 109 | + {{#if (ne benchmark.base_writes "0")}} |
| 110 | + .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64)) |
| 111 | + {{/if}} |
| 112 | + {{#each benchmark.component_writes as |cw|}} |
| 113 | + .saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) |
| 114 | + {{/each}} |
| 115 | + {{#each benchmark.component_calculated_proof_size as |cp|}} |
| 116 | + .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into())) |
| 117 | + {{/each}} |
| 118 | + } |
| 119 | + {{/each}} |
| 120 | +} |
0 commit comments