referrerpolicy=no-referrer-when-downgrade

Module benchmarking

Source
Expand description

Staking pallet benchmarking.

Modules§

baseline
A set of benchmarks which can establish a global baseline for all other benchmarking. These benchmarks do not require a pallet to be deployed.
v1
Macros for benchmarking a FRAME runtime.

Macros§

add_benchmark
This macro adds pallet benchmarks to a Vec<BenchmarkBatch> object.
assert_impl_all
Asserts that the type implements all of the given traits.
assert_type_eq_all
Asserts that all types in a list are equal to each other.
benchmarks_instance
Same as benchmarks but for instantiable module.
benchmarks_instance_pallet
Same as benchmarks but for instantiable pallet declared frame_support::pallet.
define_benchmarks
Defines pallet configs that add_benchmarks and list_benchmarks use. Should be preferred instead of having a repetitive list of configs in add_benchmark and list_benchmark.
impl_benchmark_test_suite
This creates a test suite which runs the module’s benchmarks.
list_benchmark
This macro allows users to easily generate a list of benchmarks for the pallets configured in the runtime.
validate_pov_mode
Validates the passed pov_modes.
whitelist
Whitelist the given account.
whitelist_account

Structs§

Analysis
BenchmarkBatch
The results of a single of benchmark.
BenchmarkBatchSplitResults
The results of a single of benchmark, where time and db results are separated.
BenchmarkConfig
Configuration used to setup and run runtime benchmarks.
BenchmarkList
A list of benchmarks available for a particular pallet and instance.
BenchmarkMetadata
BenchmarkRecording
Records the time and proof size of a single benchmark iteration.
BenchmarkResult
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.
Linear
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 from 0 to 1000, inclusive.

Enums§

AnalysisChoice
BenchmarkError
Possible errors returned from the benchmarking pipeline.
BenchmarkParameter
An alphabet of possible parameters to use for benchmarking.
BenchmarkSelector

Traits§

Benchmark
Runtime api for benchmarking a FRAME runtime.
Benchmarking
The pallet benchmarking trait.
BenchmarkingSetup
The required setup for creating a benchmark.
ParamRange
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 just Linear but this could later be extended to support additional non-linear parameter ranges.
Recording
The recording trait used to mark the start and end of a benchmark.

Functions§

account
Grab an account, seeded by a name and index.
current_time
Get the number of nanoseconds passed since the UNIX epoch
show_benchmark_debug_info
show error message and debugging info for the case of an error happening during a benchmark
whitelisted_caller
This caller account is automatically whitelisted for DB reads/writes by the benchmarking macro.

Attribute Macros§

benchmark
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.
benchmarks
An attribute macro that can be attached to a (non-empty) module declaration. Doing so will designate that module as a benchmarking module.
block
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.
extrinsic_call
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.
instance_benchmarks
An attribute macro that can be attached to a (non-empty) module declaration. Doing so will designate that module as an instance benchmarking module.