Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
node-template: use new define_benchmarks syntax
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Jan 5, 2022
commit b883c8c051708694d9ab6c57dd6dc0c27f646943
28 changes: 16 additions & 12 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,20 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem,
>;

#[macro_use]
extern crate frame_benchmarking;

#[cfg(feature = "runtime-benchmarks")]
mod benches {
define_benchmarks!(
[frame_benchmarking, BaselineBench::<Runtime>]
[frame_system, SystemBench::<Runtime>]
[pallet_balances, Balances]
[pallet_timestamp, Timestamp]
[pallet_template, TemplateModule]
);
}

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down Expand Up @@ -461,12 +475,7 @@ impl_runtime_apis! {
use baseline::Pallet as BaselineBench;

let mut list = Vec::<BenchmarkList>::new();

list_benchmark!(list, extra, frame_benchmarking, BaselineBench::<Runtime>);
list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_template, TemplateModule);
list_benchmarks!(list, extra);

let storage_info = AllPalletsWithSystem::storage_info();

Expand Down Expand Up @@ -499,12 +508,7 @@ impl_runtime_apis! {

let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);

add_benchmark!(params, batches, frame_benchmarking, BaselineBench::<Runtime>);
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_template, TemplateModule);
add_benchmarks!(params, batches);

Ok(batches)
}
Expand Down