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

Commit

Permalink
Repair and extend some benchmarks (#5648)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi authored Apr 24, 2020
1 parent 72c2775 commit a9c1b75
Show file tree
Hide file tree
Showing 10 changed files with 1,174 additions and 320 deletions.
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,13 @@ impl_runtime_apis! {
add_benchmark!(params, batches, b"democracy", Democracy);
add_benchmark!(params, batches, b"identity", Identity);
add_benchmark!(params, batches, b"im-online", ImOnline);
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
add_benchmark!(params, batches, b"session", SessionBench::<Runtime>);
add_benchmark!(params, batches, b"staking", Staking);
add_benchmark!(params, batches, b"timestamp", Timestamp);
add_benchmark!(params, batches, b"treasury", Treasury);
add_benchmark!(params, batches, b"utility", Utility);
add_benchmark!(params, batches, b"vesting", Vesting);
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
Expand Down
10 changes: 8 additions & 2 deletions frame/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ macro_rules! impl_benchmark {
let steps = steps.get(idx).cloned().unwrap_or(prev_steps);
prev_steps = steps;

// Skip this loop if steps is zero
if steps == 0 { continue }

let lowest = lowest_range_values.get(idx).cloned().unwrap_or(*low);
let highest = highest_range_values.get(idx).cloned().unwrap_or(*high);

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

// Skip this loop if steps is zero
if steps == 0 { continue }

let lowest = lowest_range_values.get(idx).cloned().unwrap_or(*low);
let highest = highest_range_values.get(idx).cloned().unwrap_or(*high);

Expand Down Expand Up @@ -1036,7 +1042,7 @@ macro_rules! add_benchmark {
&steps[..],
repeat,
)?,
pallet: pallet.to_vec(),
pallet: $name.to_vec(),
benchmark: benchmark.to_vec(),
});
}
Expand All @@ -1049,7 +1055,7 @@ macro_rules! add_benchmark {
&steps[..],
repeat,
)?,
pallet: pallet.to_vec(),
pallet: $name.to_vec(),
benchmark: benchmark.clone(),
});
}
Expand Down
Loading

0 comments on commit a9c1b75

Please sign in to comment.