Module polkadot_sdk_frame::benchmarking::prelude
source · Re-exports§
pub use crate::prelude::*;
Modules§
- A set of benchmarks which can establish a global baseline for all other benchmarking. These benchmarks do not require a pallet to be deployed.
- Macros for benchmarking a FRAME runtime.
Macros§
- This macro adds pallet benchmarks to a
Vec<BenchmarkBatch>
object. - Asserts that the type implements all of the given traits.
- Asserts that all types in a list are equal to each other.
- Same as
benchmarks
but for instantiable module. - Same as
benchmarks
but for instantiable pallet declaredframe_support::pallet
. - Defines pallet configs that
add_benchmarks
andlist_benchmarks
use. Should be preferred instead of having a repetitive list of configs inadd_benchmark
andlist_benchmark
. - This creates a test suite which runs the module’s benchmarks.
- This macro allows users to easily generate a list of benchmarks for the pallets configured in the runtime.
- Validates the passed
pov_mode
s. - Whitelist the given account.
Structs§
- The results of a single of benchmark.
- The results of a single of benchmark, where time and db results are separated.
- Configuration used to setup and run runtime benchmarks.
- A list of benchmarks available for a particular pallet and instance.
- Records the time and proof size of a single benchmark iteration.
- Result from running benchmarks on a FRAME pallet. Contains duration of the function call in nanoseconds along with the benchmark parameters used for that benchmark result.
- Provides implementations for the extern host functions.
- Used by the new benchmarking code to specify that a benchmarking variable is linear over some specified range, i.e.
Linear<0, 1_000>
means that the corresponding variable is allowed to range from0
to1000
, inclusive.
Enums§
- Possible errors returned from the benchmarking pipeline.
- An alphabet of possible parameters to use for benchmarking.
- Origin for the System pallet.
Traits§
- Runtime api for benchmarking a FRAME runtime.
- The pallet benchmarking trait.
- The required setup for creating a benchmark.
- Trait that must be implemented by all structs that can be used as parameter range types in the new benchmarking code (i.e.
Linear<0, 1_000>
). Right now there is justLinear
but this could later be extended to support additional non-linear parameter ranges. - The recording trait used to mark the start and end of a benchmark.
Functions§
- Grab an account, seeded by a name and index.
- Commit pending storage changes to the trie database and clear the database cache.
- Get the number of nanoseconds passed since the UNIX epoch
- Get the DB whitelist.
- Get current estimated proof size.
- Get the read/write count.
- Reset the read/write count.
- Set the DB whitelist.
- show error message and debugging info for the case of an error happening during a benchmark
- This caller account is automatically whitelisted for DB reads/writes by the benchmarking macro.
- Reset the trie database to the genesis state.
Attribute Macros§
- An attribute macro used to declare a benchmark within a benchmarking module. Must be attached to a function definition containing an
#[extrinsic_call]
or#[block]
attribute. - An attribute macro that can be attached to a (non-empty) module declaration. Doing so will designate that module as a benchmarking module.
- An attribute macro used to specify that a block should be the measured portion of the enclosing benchmark function, This attribute is also used as a boundary designating where the benchmark setup code ends, and the benchmark verification code begins.
- An attribute macro used to specify the extrinsic call inside a benchmark function, and also used as a boundary designating where the benchmark setup code ends, and the benchmark verification code begins.
- An attribute macro that can be attached to a (non-empty) module declaration. Doing so will designate that module as an instance benchmarking module.