From f89f6117a38d75079f76bc80f35c0811c537558e Mon Sep 17 00:00:00 2001 From: muharem Date: Fri, 11 Aug 2023 15:33:45 +0200 Subject: [PATCH 1/2] add instance name to the bench list command --- .../benchmarking-cli/src/pallet/command.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/utils/frame/benchmarking-cli/src/pallet/command.rs b/utils/frame/benchmarking-cli/src/pallet/command.rs index 84da3aaa02c00..10eac62d47431 100644 --- a/utils/frame/benchmarking-cli/src/pallet/command.rs +++ b/utils/frame/benchmarking-cli/src/pallet/command.rs @@ -277,6 +277,7 @@ impl PalletCmd { benchmark.name.clone(), benchmark.components.clone(), benchmark.pov_modes.clone(), + item.instance.clone(), )) } } @@ -294,6 +295,7 @@ impl PalletCmd { (String::from_utf8(p).unwrap(), String::from_utf8(s).unwrap()) }) .collect(), + b.4, ) }) .collect(); @@ -316,7 +318,7 @@ impl PalletCmd { let mut component_ranges = HashMap::<(Vec, Vec), Vec>::new(); let pov_modes = Self::parse_pov_modes(&benchmarks_to_run)?; - for (pallet, extrinsic, components, _) in benchmarks_to_run.clone() { + for (pallet, extrinsic, components, _, _) in benchmarks_to_run.clone() { log::info!( target: LOG_TARGET, "Starting benchmark: {}::{}", @@ -694,12 +696,13 @@ impl PalletCmd { Vec, Vec<(BenchmarkParameter, u32, u32)>, Vec<(String, String)>, + Vec, )>, ) -> Result { use std::collections::hash_map::Entry; let mut parsed = PovModesMap::new(); - for (pallet, call, _components, pov_modes) in benchmarks { + for (pallet, call, _components, pov_modes, _) in benchmarks { for (pallet_storage, mode) in pov_modes { let mode = PovEstimationMode::from_str(&mode)?; let splits = pallet_storage.split("::").collect::>(); @@ -753,10 +756,16 @@ fn list_benchmark( Vec, Vec<(BenchmarkParameter, u32, u32)>, Vec<(String, String)>, + Vec, )>, ) { println!("pallet, benchmark"); - for (pallet, extrinsic, _, _) in benchmarks_to_run { - println!("{}, {}", String::from_utf8_lossy(&pallet), String::from_utf8_lossy(&extrinsic)); + for (pallet, extrinsic, _, _, instance) in benchmarks_to_run { + println!( + "{}, {}, {}", + String::from_utf8_lossy(&pallet), + String::from_utf8_lossy(&extrinsic), + String::from_utf8_lossy(&instance), + ); } } From e1e122510cb5303d82a5680c455b24d63996f5af Mon Sep 17 00:00:00 2001 From: muharem Date: Fri, 11 Aug 2023 15:34:28 +0200 Subject: [PATCH 2/2] instance name example --- bin/node/runtime/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 4e1b6d4e8bec0..9060eac42a6ff 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -2066,7 +2066,7 @@ mod benches { [pallet_staking, Staking] [pallet_state_trie_migration, StateTrieMigration] [pallet_sudo, Sudo] - [frame_system, SystemBench::] + [frame_system, SystemBench] [pallet_timestamp, Timestamp] [pallet_tips, Tips] [pallet_transaction_storage, TransactionStorage] @@ -2554,10 +2554,11 @@ impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use pallet_election_provider_support_benchmarking::Pallet as EPSBench; - use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; + type SystemBench = frame_system_benchmarking::Pallet::; + let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -2577,10 +2578,11 @@ impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; use pallet_election_provider_support_benchmarking::Pallet as EPSBench; - use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; + type SystemBench = frame_system_benchmarking::Pallet::; + impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} impl pallet_election_provider_support_benchmarking::Config for Runtime {}