Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

benchmark cli: pallet list returns instance names #14757

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ mod benches {
[pallet_staking, Staking]
[pallet_state_trie_migration, StateTrieMigration]
[pallet_sudo, Sudo]
[frame_system, SystemBench::<Runtime>]
[frame_system, SystemBench]
[pallet_timestamp, Timestamp]
[pallet_tips, Tips]
[pallet_transaction_storage, TransactionStorage]
Expand Down Expand Up @@ -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::<Runtime>;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);

Expand All @@ -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::<Runtime>;

impl pallet_session_benchmarking::Config for Runtime {}
impl pallet_offences_benchmarking::Config for Runtime {}
impl pallet_election_provider_support_benchmarking::Config for Runtime {}
Expand Down
17 changes: 13 additions & 4 deletions utils/frame/benchmarking-cli/src/pallet/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ impl PalletCmd {
benchmark.name.clone(),
benchmark.components.clone(),
benchmark.pov_modes.clone(),
item.instance.clone(),
))
}
}
Expand All @@ -294,6 +295,7 @@ impl PalletCmd {
(String::from_utf8(p).unwrap(), String::from_utf8(s).unwrap())
})
.collect(),
b.4,
)
})
.collect();
Expand All @@ -316,7 +318,7 @@ impl PalletCmd {
let mut component_ranges = HashMap::<(Vec<u8>, Vec<u8>), Vec<ComponentRange>>::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: {}::{}",
Expand Down Expand Up @@ -694,12 +696,13 @@ impl PalletCmd {
Vec<u8>,
Vec<(BenchmarkParameter, u32, u32)>,
Vec<(String, String)>,
Vec<u8>,
)>,
) -> Result<PovModesMap> {
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::<Vec<_>>();
Expand Down Expand Up @@ -753,10 +756,16 @@ fn list_benchmark(
Vec<u8>,
Vec<(BenchmarkParameter, u32, u32)>,
Vec<(String, String)>,
Vec<u8>,
)>,
) {
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),
);
}
}