Skip to content
Snippets Groups Projects
Unverified Commit dcca51e0 authored by bgallois's avatar bgallois
Browse files

Add extrinsic_weights benchmark

parent 41f9ed72
No related branches found
No related tags found
1 merge request!167Storage benchmark
Pipeline #31963 passed
......@@ -69,7 +69,7 @@ pub fn block_weights(
expected_block_weight: Weight,
normal_ratio: sp_arithmetic::Perbill,
) -> frame_system::limits::BlockWeights {
let base_weight = DbWeight::get().reads(1) + DbWeight::get().writes(1);
let base_weight = crate::weights::extrinsic_weights::ExtrinsicBaseWeight::get();
let normal_weight = normal_ratio * expected_block_weight;
frame_system::limits::BlockWeights::builder()
.base_block(crate::weights::block_weights::BlockExecutionWeight::get())
......
......@@ -20,6 +20,7 @@
#![allow(clippy::unnecessary_cast)]
pub mod block_weights;
pub mod extrinsic_weights;
pub mod frame_system;
pub mod pallet_babe;
pub mod pallet_balances;
......
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-05-19 (Y/M/D)
//! HOSTNAME: `benjamin-xps139380`, CPU: `Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: `runtime/common/src/weights/`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`
// Executed Command:
// target/release/duniter
// benchmark
// overhead
// --chain=gdev-benchmark
// --execution=wasm
// --wasm-execution=compiled
// --weight-path=runtime/common/src/weights/
// --warmup=10
use sp_core::parameter_types;
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
parameter_types! {
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 203_855, 206_882
/// Average: 204_580
/// Median: 204_521
/// Std-Dev: 405.03
///
/// Percentiles nanoseconds:
/// 99th: 205_581
/// 95th: 205_130
/// 75th: 204_772
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(204_580);
}
#[cfg(test)]
mod test_weights {
use sp_weights::constants;
/// Checks that the weight exists and is sane.
// NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it.
#[test]
fn sane() {
let w = super::ExtrinsicBaseWeight::get();
// At least 10 µs.
assert!(
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
"Weight should be at least 10 µs."
);
// At most 1 ms.
assert!(
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
"Weight should be at most 1 ms."
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment