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

Commit a9c1b75

Browse files
authored
Repair and extend some benchmarks (#5648)
1 parent 72c2775 commit a9c1b75

File tree

10 files changed

+1174
-320
lines changed

10 files changed

+1174
-320
lines changed

bin/node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,13 @@ impl_runtime_apis! {
903903
add_benchmark!(params, batches, b"democracy", Democracy);
904904
add_benchmark!(params, batches, b"identity", Identity);
905905
add_benchmark!(params, batches, b"im-online", ImOnline);
906+
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
906907
add_benchmark!(params, batches, b"session", SessionBench::<Runtime>);
907908
add_benchmark!(params, batches, b"staking", Staking);
908909
add_benchmark!(params, batches, b"timestamp", Timestamp);
909910
add_benchmark!(params, batches, b"treasury", Treasury);
910911
add_benchmark!(params, batches, b"utility", Utility);
911912
add_benchmark!(params, batches, b"vesting", Vesting);
912-
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
913913

914914
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
915915
Ok(batches)

frame/benchmarking/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ macro_rules! impl_benchmark {
723723
let steps = steps.get(idx).cloned().unwrap_or(prev_steps);
724724
prev_steps = steps;
725725

726+
// Skip this loop if steps is zero
727+
if steps == 0 { continue }
728+
726729
let lowest = lowest_range_values.get(idx).cloned().unwrap_or(*low);
727730
let highest = highest_range_values.get(idx).cloned().unwrap_or(*high);
728731

@@ -828,6 +831,9 @@ macro_rules! impl_benchmark {
828831
let steps = steps.get(idx).cloned().unwrap_or(prev_steps);
829832
prev_steps = steps;
830833

834+
// Skip this loop if steps is zero
835+
if steps == 0 { continue }
836+
831837
let lowest = lowest_range_values.get(idx).cloned().unwrap_or(*low);
832838
let highest = highest_range_values.get(idx).cloned().unwrap_or(*high);
833839

@@ -1036,7 +1042,7 @@ macro_rules! add_benchmark {
10361042
&steps[..],
10371043
repeat,
10381044
)?,
1039-
pallet: pallet.to_vec(),
1045+
pallet: $name.to_vec(),
10401046
benchmark: benchmark.to_vec(),
10411047
});
10421048
}
@@ -1049,7 +1055,7 @@ macro_rules! add_benchmark {
10491055
&steps[..],
10501056
repeat,
10511057
)?,
1052-
pallet: pallet.to_vec(),
1058+
pallet: $name.to_vec(),
10531059
benchmark: benchmark.clone(),
10541060
});
10551061
}

0 commit comments

Comments
 (0)