Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

WeightInfo for System, Timestamp, and Utility #6868

Merged
15 commits merged into from
Aug 17, 2020
Prev Previous commit
Next Next commit
finish system weights
  • Loading branch information
shawntabrizi committed Aug 5, 2020
commit 0277875142b95cd685304f2f9678e78310c3ba9b
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl frame_system::Trait for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SystemWeightInfo = weights::frame_system::WeightInfo;
}

impl pallet_utility::Trait for Runtime {
Expand Down
28 changes: 11 additions & 17 deletions bin/node/runtime/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,38 @@

use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};

impl crate::WeightInfo for () {
pub struct WeightInfo;
impl frame_system::WeightInfo for WeightInfo {
// WARNING! Some components were not used: ["b"]
fn remark() -> Weight {
(1385000 as Weight)
(1305000 as Weight)
}
// WARNING! Some components were not used: ["i"]
fn set_heap_pages() -> Weight {
(2098000 as Weight)
.saturating_add(DbWeight::get().writes(1 as Weight))
}
// WARNING! Some components were not used: ["b"]
fn set_code_without_checks() -> Weight {
(21572000 as Weight)
(2023000 as Weight)
.saturating_add(DbWeight::get().writes(1 as Weight))
}
// WARNING! Some components were not used: ["d"]
fn set_changes_trie_config() -> Weight {
(10546000 as Weight)
(10026000 as Weight)
.saturating_add(DbWeight::get().reads(1 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn set_storage(i: u32, ) -> Weight {
(0 as Weight)
.saturating_add((654000 as Weight).saturating_mul(i as Weight))
.saturating_add((656000 as Weight).saturating_mul(i as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_storage(i: u32, ) -> Weight {
(4210000 as Weight)
.saturating_add((490000 as Weight).saturating_mul(i as Weight))
(4327000 as Weight)
.saturating_add((478000 as Weight).saturating_mul(i as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_prefix(p: u32, ) -> Weight {
(11452000 as Weight)
.saturating_add((831000 as Weight).saturating_mul(p as Weight))
(8349000 as Weight)
.saturating_add((838000 as Weight).saturating_mul(p as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
// WARNING! Some components were not used: ["n"]
fn suicide() -> Weight {
(30017000 as Weight)
(29247000 as Weight)
}
}
1 change: 1 addition & 0 deletions bin/node/runtime/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@

//! A list of the different weight modules for our runtime.

pub mod frame_system;
pub mod pallet_balances;
pub mod pallet_democracy;
19 changes: 10 additions & 9 deletions frame/system/src/default_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,36 @@
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};

impl crate::WeightInfo for () {
// WARNING! Some components were not used: ["b"]
fn remark() -> Weight {
(1411000 as Weight)
(1305000 as Weight)
}
fn set_heap_pages() -> Weight {
(1947000 as Weight)
(2023000 as Weight)
.saturating_add(DbWeight::get().writes(1 as Weight))
}
// WARNING! Some components were not used: ["d"]
fn set_changes_trie_config() -> Weight {
(9804000 as Weight)
(10026000 as Weight)
.saturating_add(DbWeight::get().reads(1 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn set_storage(i: u32, ) -> Weight {
(0 as Weight)
.saturating_add((655000 as Weight).saturating_mul(i as Weight))
.saturating_add((656000 as Weight).saturating_mul(i as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_storage(i: u32, ) -> Weight {
(1630000 as Weight)
.saturating_add((476000 as Weight).saturating_mul(i as Weight))
(4327000 as Weight)
.saturating_add((478000 as Weight).saturating_mul(i as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
fn kill_prefix(p: u32, ) -> Weight {
(9295000 as Weight)
.saturating_add((845000 as Weight).saturating_mul(p as Weight))
(8349000 as Weight)
.saturating_add((838000 as Weight).saturating_mul(p as Weight))
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
fn suicide() -> Weight {
(29068000 as Weight)
(29247000 as Weight)
}
}