difftreelog
bench collator selection
in: master
1 file changed
pallets/collator-selection/src/weights.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2021 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435#![allow(unused_parens)]36#![allow(unused_imports)]3738use frame_support::{39 traits::Get,40 weights::{constants::RocksDbWeight, Weight},41};42use sp_std::marker::PhantomData;4344// The weight info trait for `pallet_collator_selection`.45pub trait WeightInfo {46 fn add_invulnerable(_b: u32) -> Weight;47 fn remove_invulnerable(_b: u32) -> Weight;48 fn get_license(_c: u32) -> Weight;49 fn onboard(_c: u32) -> Weight;50 fn offboard(_c: u32) -> Weight;51 fn release_license(_c: u32) -> Weight;52 fn force_release_license(_c: u32) -> Weight;53 fn note_author() -> Weight;54 fn new_session(_c: u32, _r: u32) -> Weight;55}5657/// Weights for pallet_collator_selection using the Substrate node and recommended hardware.58pub struct SubstrateWeight<T>(PhantomData<T>);59impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {60 fn add_invulnerable(b: u32) -> Weight {61 Weight::from_ref_time(18_563_000 as u64)62 // Standard Error: 063 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))64 .saturating_add(T::DbWeight::get().writes(1 as u64))65 }66 fn remove_invulnerable(b: u32) -> Weight {67 Weight::from_ref_time(18_563_000 as u64)68 // Standard Error: 069 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))70 .saturating_add(T::DbWeight::get().writes(1 as u64))71 }72 fn get_license(c: u32) -> Weight {73 Weight::from_ref_time(71_196_000 as u64)74 // Standard Error: 075 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))76 .saturating_add(T::DbWeight::get().reads(4 as u64))77 .saturating_add(T::DbWeight::get().writes(2 as u64))78 }79 fn onboard(c: u32) -> Weight {80 Weight::from_ref_time(71_196_000 as u64)81 // Standard Error: 082 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))83 .saturating_add(T::DbWeight::get().reads(4 as u64))84 .saturating_add(T::DbWeight::get().writes(2 as u64))85 }86 fn offboard(c: u32) -> Weight {87 Weight::from_ref_time(55_336_000 as u64)88 // Standard Error: 089 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))90 .saturating_add(T::DbWeight::get().reads(1 as u64))91 .saturating_add(T::DbWeight::get().writes(2 as u64))92 }93 fn release_license(c: u32) -> Weight {94 Weight::from_ref_time(55_336_000 as u64)95 // Standard Error: 096 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))97 .saturating_add(T::DbWeight::get().reads(1 as u64))98 .saturating_add(T::DbWeight::get().writes(2 as u64))99 }100 fn force_release_license(c: u32) -> Weight {101 Weight::from_ref_time(55_336_000 as u64)102 // Standard Error: 0103 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))104 .saturating_add(T::DbWeight::get().reads(1 as u64))105 .saturating_add(T::DbWeight::get().writes(2 as u64))106 }107 fn note_author() -> Weight {108 Weight::from_ref_time(71_461_000 as u64)109 .saturating_add(T::DbWeight::get().reads(3 as u64))110 .saturating_add(T::DbWeight::get().writes(4 as u64))111 }112 fn new_session(r: u32, c: u32) -> Weight {113 Weight::from_ref_time(0 as u64)114 // Standard Error: 1_010_000115 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))116 // Standard Error: 1_010_000117 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))118 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))119 .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))120 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64)))121 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))122 }123}124125// For backwards compatibility and tests126impl WeightInfo for () {127 fn add_invulnerable(b: u32) -> Weight {128 Weight::from_ref_time(18_563_000 as u64)129 // Standard Error: 0130 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))131 .saturating_add(RocksDbWeight::get().writes(1 as u64))132 }133 fn remove_invulnerable(b: u32) -> Weight {134 Weight::from_ref_time(18_563_000 as u64)135 // Standard Error: 0136 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))137 .saturating_add(RocksDbWeight::get().writes(1 as u64))138 }139 fn get_license(c: u32) -> Weight {140 Weight::from_ref_time(71_196_000 as u64)141 // Standard Error: 0142 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))143 .saturating_add(RocksDbWeight::get().reads(4 as u64))144 .saturating_add(RocksDbWeight::get().writes(2 as u64))145 }146 fn onboard(c: u32) -> Weight {147 Weight::from_ref_time(71_196_000 as u64)148 // Standard Error: 0149 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))150 .saturating_add(RocksDbWeight::get().reads(4 as u64))151 .saturating_add(RocksDbWeight::get().writes(2 as u64))152 }153 fn offboard(c: u32) -> Weight {154 Weight::from_ref_time(55_336_000 as u64)155 // Standard Error: 0156 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))157 .saturating_add(RocksDbWeight::get().reads(1 as u64))158 .saturating_add(RocksDbWeight::get().writes(2 as u64))159 }160 fn release_license(c: u32) -> Weight {161 Weight::from_ref_time(55_336_000 as u64)162 // Standard Error: 0163 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))164 .saturating_add(RocksDbWeight::get().reads(1 as u64))165 .saturating_add(RocksDbWeight::get().writes(2 as u64))166 }167 fn force_release_license(c: u32) -> Weight {168 Weight::from_ref_time(55_336_000 as u64)169 // Standard Error: 0170 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))171 .saturating_add(RocksDbWeight::get().reads(1 as u64))172 .saturating_add(RocksDbWeight::get().writes(2 as u64))173 }174 fn note_author() -> Weight {175 Weight::from_ref_time(71_461_000 as u64)176 .saturating_add(RocksDbWeight::get().reads(3 as u64))177 .saturating_add(RocksDbWeight::get().writes(4 as u64))178 }179 fn new_session(r: u32, c: u32) -> Weight {180 Weight::from_ref_time(0 as u64)181 // Standard Error: 1_010_000182 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))183 // Standard Error: 1_010_000184 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))185 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64)))186 .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))187 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64)))188 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))189 }190}