Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7468464
initial mockup
shawntabrizi Jun 17, 2020
947d68c
add and wipe
shawntabrizi Jun 17, 2020
9c77f50
track writes
shawntabrizi Jun 17, 2020
2f198b9
start to add to pipeline
shawntabrizi Jun 18, 2020
12395ae
return all reads/writes
shawntabrizi Jun 18, 2020
69f137d
Log reads and writes from bench db
shawntabrizi Jun 18, 2020
60f22c3
causes panic
shawntabrizi Jun 18, 2020
e08ffef
Allow multiple commits
arkpar Jun 18, 2020
86ecbeb
commit before ending benchmark
shawntabrizi Jun 18, 2020
f7305a2
Merge branch 'master' into shawntabrizi-bench-db-tracking
shawntabrizi Jun 18, 2020
004bea1
doesn't work???
shawntabrizi Jun 18, 2020
1b25a8b
fix
shawntabrizi Jun 18, 2020
c995215
Update lib.rs
shawntabrizi Jun 18, 2020
2eef7fa
switch to struct for `BenchmarkResults`
shawntabrizi Jun 18, 2020
473f492
add to output
shawntabrizi Jun 18, 2020
0ae5300
fix test
shawntabrizi Jun 18, 2020
fd99bda
line width
shawntabrizi Jun 18, 2020
79cd015
@kianenigma review
shawntabrizi Jun 18, 2020
9464475
Add Whitelist to DB Tracking in Benchmarks Pipeline (#6405)
shawntabrizi Jun 20, 2020
956cda1
Add regression analysis to DB Tracking (#6475)
shawntabrizi Jun 22, 2020
962a3f5
initial idea
shawntabrizi Jun 23, 2020
c3e9639
use all benchmarks
shawntabrizi Jun 23, 2020
87dfc19
broken
shawntabrizi Jun 23, 2020
6f82848
working without trait
shawntabrizi Jun 23, 2020
78ca73e
Make work for multiple pallets
shawntabrizi Jun 23, 2020
decc972
Merge branch 'master' into shawntabrizi-output-benchmarks
shawntabrizi Jun 27, 2020
b38d82e
Fix merge issues
shawntabrizi Jun 27, 2020
ccff2e1
writer appends to file
shawntabrizi Jun 28, 2020
02f69ff
implement () for balances weight trait
shawntabrizi Jul 2, 2020
e51814a
Merge branch 'master' into shawntabrizi-output-benchmarks
shawntabrizi Jul 2, 2020
aa17f5c
update name of trait
shawntabrizi Jul 2, 2020
c83c7fb
Weights to WeightInfo
shawntabrizi Jul 2, 2020
b29eef1
auto trait writer
shawntabrizi Jul 2, 2020
b2b7205
Start adding weight info
shawntabrizi Jul 2, 2020
4eda4bc
More weightinfo
shawntabrizi Jul 2, 2020
9dfa60d
finish weight info
shawntabrizi Jul 2, 2020
464c2f2
more fixes
shawntabrizi Jul 3, 2020
2c5e0ff
inital update of node runtime
shawntabrizi Jul 3, 2020
9aa9267
Initial benchmarks
shawntabrizi Jul 3, 2020
415fb0d
Add staking weights
shawntabrizi Jul 3, 2020
cff48e2
Heap pages are configurable
shawntabrizi Jul 3, 2020
b359b5a
fix the rest of the compilation
shawntabrizi Jul 3, 2020
7e11dd6
Update vesting weights
shawntabrizi Jul 3, 2020
bdc6742
Update weight formulas for Vesting
shawntabrizi Jul 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/node-template/pallets/template/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl system::Trait for Test {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl Trait for Test {
type Event = ();
Expand Down
59 changes: 59 additions & 0 deletions bin/node/runtime/src/benchmarks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
use frame_support::weights::{Weight, constants::RocksDbWeight};
pub struct WeightForBalances;
impl pallet_balances::WeightInfo for WeightForBalances {
fn transfer(u: u32, e: u32, ) -> Weight {
(574875000 as Weight)
.saturating_add((u as Weight).saturating_mul(7000 as Weight))
.saturating_add((e as Weight).saturating_mul(0 as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().reads((e as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes((e as Weight).saturating_mul(0 as Weight)))
}
fn transfer_best_case(u: u32, e: u32, ) -> Weight {
(368265000 as Weight)
.saturating_add((u as Weight).saturating_mul(26000 as Weight))
.saturating_add((e as Weight).saturating_mul(0 as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().reads((e as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes((e as Weight).saturating_mul(0 as Weight)))
}
fn transfer_keep_alive(u: u32, e: u32, ) -> Weight {
(402076000 as Weight)
.saturating_add((u as Weight).saturating_mul(7000 as Weight))
.saturating_add((e as Weight).saturating_mul(14000 as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().reads((e as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes((e as Weight).saturating_mul(0 as Weight)))
}
fn set_balance(u: u32, e: u32, ) -> Weight {
(341092000 as Weight)
.saturating_add((u as Weight).saturating_mul(0 as Weight))
.saturating_add((e as Weight).saturating_mul(12000 as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().reads((e as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(RocksDbWeight::get().writes((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes((e as Weight).saturating_mul(0 as Weight)))
}
fn set_balance_killing(u: u32, e: u32, ) -> Weight {
(412116000 as Weight)
.saturating_add((u as Weight).saturating_mul(28000 as Weight))
.saturating_add((e as Weight).saturating_mul(0 as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().reads((e as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(RocksDbWeight::get().writes((u as Weight).saturating_mul(0 as Weight)))
.saturating_add(RocksDbWeight::get().writes((e as Weight).saturating_mul(0 as Weight)))
}
}
21 changes: 21 additions & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ use impls::{CurrencyToVoteHandler, Author};
pub mod constants;
use constants::{time::*, currency::*};

pub mod benchmarks;

// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
Expand Down Expand Up @@ -171,11 +173,13 @@ impl frame_system::Trait for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

impl pallet_utility::Trait for Runtime {
type Event = Event;
type Call = Call;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -193,6 +197,7 @@ impl pallet_multisig::Trait for Runtime {
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -246,6 +251,7 @@ impl pallet_proxy::Trait for Runtime {
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -259,6 +265,7 @@ impl pallet_scheduler::Trait for Runtime {
type Call = Call;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -281,6 +288,7 @@ impl pallet_indices::Trait for Runtime {
type Currency = Balances;
type Deposit = IndexDeposit;
type Event = Event;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -293,6 +301,7 @@ impl pallet_balances::Trait for Runtime {
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Module<Runtime>;
type WeightInfo = benchmarks::WeightForBalances;
}

parameter_types! {
Expand All @@ -319,6 +328,7 @@ impl pallet_timestamp::Trait for Runtime {
type Moment = Moment;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -355,6 +365,7 @@ impl pallet_session::Trait for Runtime {
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Runtime {
Expand Down Expand Up @@ -411,6 +422,7 @@ impl pallet_staking::Trait for Runtime {
type MinSolutionScoreBump = MinSolutionScoreBump;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type UnsignedPriority = StakingUnsignedPriority;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -459,6 +471,7 @@ impl pallet_democracy::Trait for Runtime {
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -473,6 +486,7 @@ impl pallet_collective::Trait<CouncilCollective> for Runtime {
type Event = Event;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -504,6 +518,7 @@ impl pallet_elections_phragmen::Trait for Runtime {
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -518,6 +533,7 @@ impl pallet_collective::Trait<TechnicalCollective> for Runtime {
type Event = Event;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals;
type WeightInfo = ();
}

type EnsureRootOrHalfCouncil = EnsureOneOf<
Expand Down Expand Up @@ -572,6 +588,7 @@ impl pallet_treasury::Trait for Runtime {
type ProposalBondMinimum = ProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -673,6 +690,7 @@ impl pallet_im_online::Trait for Runtime {
type SessionDuration = SessionDuration;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = ();
}

parameter_types! {
Expand All @@ -684,6 +702,7 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}

impl pallet_authority_discovery::Trait for Runtime {}
Expand Down Expand Up @@ -742,6 +761,7 @@ impl pallet_identity::Trait for Runtime {
type Slashed = Treasury;
type ForceOrigin = EnsureRootOrHalfCouncil;
type RegistrarOrigin = EnsureRootOrHalfCouncil;
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -798,6 +818,7 @@ impl pallet_vesting::Trait for Runtime {
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
}

construct_runtime!(
Expand Down
1 change: 1 addition & 0 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl Trait for Test {
type Event = ();
Expand Down
2 changes: 2 additions & 0 deletions frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl frame_system::Trait for Test {
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
Expand All @@ -64,6 +65,7 @@ impl pallet_balances::Trait for Test {
type Event = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
}
parameter_types! {
pub const ProofLimit: u32 = 1024;
Expand Down
2 changes: 2 additions & 0 deletions frame/aura/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ impl frame_system::Trait for Test {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

impl pallet_timestamp::Trait for Test {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}

impl Trait for Test {
Expand Down
2 changes: 2 additions & 0 deletions frame/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ mod tests {
type ValidatorIdOf = ConvertInto;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Test {
Expand Down Expand Up @@ -167,6 +168,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

impl_outer_origin! {
Expand Down
1 change: 1 addition & 0 deletions frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

parameter_types! {
Expand Down
3 changes: 3 additions & 0 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl frame_system::Trait for Test {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}

impl_opaque_keys! {
Expand All @@ -99,12 +100,14 @@ impl pallet_session::Trait for Test {
type Keys = MockSessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type NextSessionRotation = Babe;
type WeightInfo = ();
}

impl pallet_timestamp::Trait for Test {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}

impl Trait for Test {
Expand Down
Loading