Skip to content

Commit 10770ca

Browse files
shawntabrizizadmarbellaParity Benchmarking Bot
authored
New Weight Template + Organization (#7391)
* add_handlebar_template_to_benchmark - add benchmark-cli arg to take in a handlebar-template file * update to always use template * rewrite writer for handlebars * polish * pass cmd data * update docs * new weight layout * separate templates * support custom filename output * Update command.rs * Create frame-weight-template.hbs * use a vector to maintain benchmark order * bring back () * fix tests * fix build * Custom string serializer, remove feature flag * temp * rename * nit * update docs * docs on public objects * small fix * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs * remove long line * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/system/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for system * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for staking * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_identity --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/identity/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for identity and staking * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_collective --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/collective/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for collective * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for democracy * clean up zeros * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_elections_phragmen --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/elections-phragmen/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for elections phragmen * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_im_online --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/im-online/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for im online * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_indices --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/indices/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for indices * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_multisig --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/multisig/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for multisig * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_proxy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/proxy/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for proxy * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_scheduler --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/scheduler/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for scheduler * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_session --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/session/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for session * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/timestamp/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for timestamp * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_treasury --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/treasury/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for treasury * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for utility * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_vesting --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/vesting/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for vesting * temp update * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Ezadkiel Marbella <zadkiel.m@gmail.com> Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
1 parent 79a829b commit 10770ca

File tree

3 files changed

+82
-39
lines changed

3 files changed

+82
-39
lines changed

src/default_weights.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#![cfg_attr(not(feature = "std"), no_std)]
9494

9595
mod benchmarking;
96-
mod default_weights;
96+
pub mod weights;
9797

9898
use sp_std::{result, cmp};
9999
use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier};
@@ -115,11 +115,7 @@ use sp_timestamp::{
115115
InherentError, INHERENT_IDENTIFIER, InherentType,
116116
OnTimestampSet,
117117
};
118-
119-
pub trait WeightInfo {
120-
fn set() -> Weight;
121-
fn on_finalize() -> Weight;
122-
}
118+
pub use weights::WeightInfo;
123119

124120
/// The module configuration trait
125121
pub trait Trait: frame_system::Trait {

src/weights.rs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
//! Weights for pallet_timestamp
19+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
20+
//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
21+
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
22+
23+
// Executed Command:
24+
// target/release/substrate
25+
// benchmark
26+
// --chain=dev
27+
// --steps=50
28+
// --repeat=20
29+
// --pallet=pallet_timestamp
30+
// --extrinsic=*
31+
// --execution=wasm
32+
// --wasm-execution=compiled
33+
// --heap-pages=4096
34+
// --output=./frame/timestamp/src/weights.rs
35+
// --template=./.maintain/frame-weight-template.hbs
36+
37+
38+
#![allow(unused_parens)]
39+
#![allow(unused_imports)]
40+
41+
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
42+
use sp_std::marker::PhantomData;
43+
44+
/// Weight functions needed for pallet_timestamp.
45+
pub trait WeightInfo {
46+
fn set() -> Weight;
47+
fn on_finalize() -> Weight;
48+
49+
}
50+
51+
/// Weights for pallet_timestamp using the Substrate node and recommended hardware.
52+
pub struct SubstrateWeight<T>(PhantomData<T>);
53+
impl<T: frame_system::Trait> WeightInfo for SubstrateWeight<T> {
54+
fn set() -> Weight {
55+
(11_650_000 as Weight)
56+
.saturating_add(T::DbWeight::get().reads(2 as Weight))
57+
.saturating_add(T::DbWeight::get().writes(1 as Weight))
58+
59+
}
60+
fn on_finalize() -> Weight {
61+
(6_681_000 as Weight)
62+
63+
}
64+
65+
}
66+
67+
// For backwards compatibility and tests
68+
impl WeightInfo for () {
69+
fn set() -> Weight {
70+
(11_650_000 as Weight)
71+
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
72+
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
73+
74+
}
75+
fn on_finalize() -> Weight {
76+
(6_681_000 as Weight)
77+
78+
}
79+
80+
}

0 commit comments

Comments
 (0)