mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
WeightInfo for System, Timestamp, and Utility (#6868)
* initial updates to system * fix compile * Update writer.rs * update weights * finish system weights * timestamp weights * utility weight * Fix overflow in weight calculations * add back weight notes * Update for whitelisted benchmarks * add trait bounds * Revert "add trait bounds" This reverts commit 12b08b7189aa3969f96fa19b211a370860fdb240. * Update weights for unaccounted for read
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5
|
||||
|
||||
#![allow(unused_parens)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
impl crate::WeightInfo for () {
|
||||
// WARNING! Some components were not used: ["t"]
|
||||
fn set() -> Weight {
|
||||
(9133000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// WARNING! Some components were not used: ["t"]
|
||||
fn on_finalize() -> Weight {
|
||||
(5915000 as Weight)
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
mod benchmarking;
|
||||
mod default_weights;
|
||||
|
||||
use sp_std::{result, cmp};
|
||||
use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier};
|
||||
@@ -116,13 +117,8 @@ use sp_timestamp::{
|
||||
};
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn set(t: u32, ) -> Weight;
|
||||
fn on_finalize(t: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn set(_t: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn on_finalize(_t: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn set() -> Weight;
|
||||
fn on_finalize() -> Weight;
|
||||
}
|
||||
|
||||
/// The module configuration trait
|
||||
@@ -166,12 +162,9 @@ decl_module! {
|
||||
/// - `O(T)` where `T` complexity of `on_timestamp_set`
|
||||
/// - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in `on_finalize`)
|
||||
/// - 1 event handler `on_timestamp_set` `O(T)`.
|
||||
/// - Benchmark: 7.678 (min squares analysis)
|
||||
/// - NOTE: This benchmark was done for a runtime with insignificant `on_timestamp_set` handlers.
|
||||
/// New benchmarking is needed when adding new handlers.
|
||||
/// # </weight>
|
||||
#[weight = (
|
||||
T::DbWeight::get().reads_writes(2, 1) + 8_000_000,
|
||||
T::WeightInfo::set(),
|
||||
DispatchClass::Mandatory
|
||||
)]
|
||||
fn set(origin, #[compact] now: T::Moment) {
|
||||
@@ -191,13 +184,12 @@ decl_module! {
|
||||
/// dummy `on_initialize` to return the weight used in `on_finalize`.
|
||||
fn on_initialize() -> Weight {
|
||||
// weight of `on_finalize`
|
||||
5_000_000
|
||||
T::WeightInfo::on_finalize()
|
||||
}
|
||||
|
||||
/// # <weight>
|
||||
/// - `O(1)`
|
||||
/// - 1 storage deletion (codec `O(1)`).
|
||||
/// - Benchmark: 4.928 µs (min squares analysis)
|
||||
/// # </weight>
|
||||
fn on_finalize() {
|
||||
assert!(<Self as Store>::DidUpdate::take(), "Timestamp must be updated once in the block");
|
||||
|
||||
Reference in New Issue
Block a user