mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
Integrate benchmark-block (#5224)
* Integrate benchmark-block Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add dep Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
41d8c97113
commit
bd33013a4b
@@ -21,6 +21,7 @@ futures = "0.3.21"
|
||||
pyro = { package = "pyroscope", version = "0.3.1", optional = true }
|
||||
|
||||
service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true }
|
||||
polkadot-client = { path = "../node/client", optional = true }
|
||||
polkadot-node-core-pvf = { path = "../node/core/pvf", optional = true }
|
||||
polkadot-performance-test = { path = "../node/test/performance-test", optional = true }
|
||||
|
||||
@@ -50,6 +51,7 @@ cli = [
|
||||
"sc-tracing",
|
||||
"frame-benchmarking-cli",
|
||||
"try-runtime-cli",
|
||||
"polkadot-client",
|
||||
"polkadot-node-core-pvf",
|
||||
"polkadot-performance-test",
|
||||
]
|
||||
|
||||
@@ -54,6 +54,14 @@ pub enum Subcommand {
|
||||
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
/// Benchmark the execution time of historic blocks and compare it to their consumed weight.
|
||||
#[clap(
|
||||
name = "benchmark-block",
|
||||
about = "Benchmark the execution time of historic blocks and compare it to their consumed weight."
|
||||
)]
|
||||
BenchmarkBlock(frame_benchmarking_cli::BlockCmd),
|
||||
|
||||
/// Sub command for benchmarking the storage speed.
|
||||
#[clap(name = "benchmark-storage", about = "Benchmark storage speed.")]
|
||||
BenchmarkStorage(frame_benchmarking_cli::StorageCmd),
|
||||
|
||||
|
||||
@@ -475,6 +475,65 @@ pub fn run() -> Result<()> {
|
||||
#[cfg(not(feature = "polkadot-native"))]
|
||||
panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
|
||||
},
|
||||
Some(Subcommand::BenchmarkBlock(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
let chain_spec = &runner.config().chain_spec;
|
||||
|
||||
#[cfg(feature = "rococo-native")]
|
||||
if chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
if let polkadot_client::Client::Rococo(pd) = &*client {
|
||||
Ok((cmd.run(pd.clone()).map_err(Error::SubstrateCli), task_manager))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "kusama-native")]
|
||||
if chain_spec.is_kusama() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
if let polkadot_client::Client::Kusama(pd) = &*client {
|
||||
Ok((cmd.run(pd.clone()).map_err(Error::SubstrateCli), task_manager))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "westend-native")]
|
||||
if chain_spec.is_westend() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
if let polkadot_client::Client::Westend(pd) = &*client {
|
||||
Ok((cmd.run(pd.clone()).map_err(Error::SubstrateCli), task_manager))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "polkadot-native")]
|
||||
{
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
if let polkadot_client::Client::Polkadot(pd) = &*client {
|
||||
Ok((cmd.run(pd.clone()).map_err(Error::SubstrateCli), task_manager))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "polkadot-native"))]
|
||||
unreachable!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
|
||||
},
|
||||
Some(Subcommand::BenchmarkStorage(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
let chain_spec = &runner.config().chain_spec;
|
||||
|
||||
Reference in New Issue
Block a user