Struct frame_benchmarking_cli::BlockCmd
source · pub struct BlockCmd {
pub shared_params: SharedParams,
pub import_params: ImportParams,
pub params: BenchmarkParams,
pub enable_trie_cache: bool,
}
Expand description
Benchmark the execution time of historic blocks.
This can be used to verify that blocks do not use more weight than they consumed
in their WeightInfo
. Example:
Let’s say you are on a Substrate chain and want to verify that the first 3 blocks did not use more weight than declared which would otherwise be an issue. To test this with a dev node, first create one with a temp directory:
$ substrate –dev -d /tmp/my-dev –wasm-execution compiled
And wait some time to let it produce 3 blocks. Then benchmark them with:
$ substrate benchmark-block –from 1 –to 3 –dev -d /tmp/my-dev –wasm-execution compiled –pruning archive
The output will be similar to this:
Block 1 with 1 tx used 77.34% of its weight ( 5,308,964 of 6,864,645 ns) Block 2 with 1 tx used 77.99% of its weight ( 5,353,992 of 6,864,645 ns) Block 3 with 1 tx used 75.91% of its weight ( 5,305,938 of 6,989,645 ns)
The percent number is important and indicates how much weight was used as compared to the consumed weight. This number should be below 100% for reference hardware.
Fields§
§import_params: ImportParams
§params: BenchmarkParams
§enable_trie_cache: bool
Enable the Trie cache.
This should only be used for performance analysis and not for final results.
Implementations§
source§impl BlockCmd
impl BlockCmd
sourcepub fn run<Block, BA, C>(&self, client: Arc<C>) -> Result<()>where
Block: BlockT<Extrinsic = OpaqueExtrinsic>,
BA: ClientBackend<Block>,
C: BlockBuilderProvider<BA, Block, C> + BlockBackend<Block> + ProvideRuntimeApi<Block> + StorageProvider<Block, BA> + UsageProvider<Block> + HeaderBackend<Block>,
C::Api: ApiExt<Block> + BlockBuilderApi<Block>,
pub fn run<Block, BA, C>(&self, client: Arc<C>) -> Result<()>where Block: BlockT<Extrinsic = OpaqueExtrinsic>, BA: ClientBackend<Block>, C: BlockBuilderProvider<BA, Block, C> + BlockBackend<Block> + ProvideRuntimeApi<Block> + StorageProvider<Block, BA> + UsageProvider<Block> + HeaderBackend<Block>, C::Api: ApiExt<Block> + BlockBuilderApi<Block>,
Benchmark the execution time of historic blocks and compare it to their consumed weight.
Output will be printed to console.
Trait Implementations§
source§impl Args for BlockCmd
impl Args for BlockCmd
source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id
][crate::ArgGroup::id] for this set of argumentssource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
source§impl CliConfiguration<()> for BlockCmd
impl CliConfiguration<()> for BlockCmd
source§fn import_params(&self) -> Option<&ImportParams>
fn import_params(&self) -> Option<&ImportParams>
source§fn trie_cache_maximum_size(&self) -> Result<Option<usize>>
fn trie_cache_maximum_size(&self) -> Result<Option<usize>>
source§fn pruning_params(&self) -> Option<&PruningParams>
fn pruning_params(&self) -> Option<&PruningParams>
source§fn keystore_params(&self) -> Option<&KeystoreParams>
fn keystore_params(&self) -> Option<&KeystoreParams>
source§fn network_params(&self) -> Option<&NetworkParams>
fn network_params(&self) -> Option<&NetworkParams>
source§fn offchain_worker_params(&self) -> Option<&OffchainWorkerParams>
fn offchain_worker_params(&self) -> Option<&OffchainWorkerParams>
OffchainWorkerParams
for this object.source§fn node_key_params(&self) -> Option<&NodeKeyParams>
fn node_key_params(&self) -> Option<&NodeKeyParams>
source§fn database_params(&self) -> Option<&DatabaseParams>
fn database_params(&self) -> Option<&DatabaseParams>
source§fn base_path(&self) -> Result<Option<BasePath>, Error>
fn base_path(&self) -> Result<Option<BasePath>, Error>
source§fn is_dev(&self) -> Result<bool, Error>
fn is_dev(&self) -> Result<bool, Error>
true
if the node is for development or not Read moresource§fn transaction_pool(&self, _is_dev: bool) -> Result<Options, Error>
fn transaction_pool(&self, _is_dev: bool) -> Result<Options, Error>
source§fn network_config(
&self,
chain_spec: &Box<dyn ChainSpec + 'static, Global>,
is_dev: bool,
is_validator: bool,
net_config_dir: PathBuf,
client_id: &str,
node_name: &str,
node_key: NodeKeyConfig,
default_listen_port: u16
) -> Result<NetworkConfiguration, Error>
fn network_config( &self, chain_spec: &Box<dyn ChainSpec + 'static, Global>, is_dev: bool, is_validator: bool, net_config_dir: PathBuf, client_id: &str, node_name: &str, node_key: NodeKeyConfig, default_listen_port: u16 ) -> Result<NetworkConfiguration, Error>
source§fn keystore_config(&self, config_dir: &PathBuf) -> Result<KeystoreConfig, Error>
fn keystore_config(&self, config_dir: &PathBuf) -> Result<KeystoreConfig, Error>
source§fn database_cache_size(&self) -> Result<Option<usize>, Error>
fn database_cache_size(&self) -> Result<Option<usize>, Error>
source§fn database(&self) -> Result<Option<Database>, Error>
fn database(&self) -> Result<Option<Database>, Error>
source§fn database_config(
&self,
base_path: &PathBuf,
cache_size: usize,
database: Database
) -> Result<DatabaseSource, Error>
fn database_config( &self, base_path: &PathBuf, cache_size: usize, database: Database ) -> Result<DatabaseSource, Error>
source§fn state_pruning(&self) -> Result<Option<PruningMode>, Error>
fn state_pruning(&self) -> Result<Option<PruningMode>, Error>
source§fn blocks_pruning(&self) -> Result<BlocksPruning, Error>
fn blocks_pruning(&self) -> Result<BlocksPruning, Error>
source§fn chain_id(&self, is_dev: bool) -> Result<String, Error>
fn chain_id(&self, is_dev: bool) -> Result<String, Error>
source§fn wasm_method(&self) -> Result<WasmExecutionMethod, Error>
fn wasm_method(&self) -> Result<WasmExecutionMethod, Error>
source§fn wasm_runtime_overrides(&self) -> Option<PathBuf>
fn wasm_runtime_overrides(&self) -> Option<PathBuf>
source§fn rpc_addr(
&self,
_default_listen_port: u16
) -> Result<Option<SocketAddr>, Error>
fn rpc_addr( &self, _default_listen_port: u16 ) -> Result<Option<SocketAddr>, Error>
source§fn rpc_methods(&self) -> Result<RpcMethods, Error>
fn rpc_methods(&self) -> Result<RpcMethods, Error>
source§fn rpc_max_connections(&self) -> Result<u32, Error>
fn rpc_max_connections(&self) -> Result<u32, Error>
source§fn rpc_cors(&self, _is_dev: bool) -> Result<Option<Vec<String, Global>>, Error>
fn rpc_cors(&self, _is_dev: bool) -> Result<Option<Vec<String, Global>>, Error>
None
if disabled) Read moresource§fn rpc_max_subscriptions_per_connection(&self) -> Result<u32, Error>
fn rpc_max_subscriptions_per_connection(&self) -> Result<u32, Error>
source§fn prometheus_config(
&self,
_default_listen_port: u16,
_chain_spec: &Box<dyn ChainSpec + 'static, Global>
) -> Result<Option<PrometheusConfig>, Error>
fn prometheus_config( &self, _default_listen_port: u16, _chain_spec: &Box<dyn ChainSpec + 'static, Global> ) -> Result<Option<PrometheusConfig>, Error>
None
if disabled) Read moresource§fn telemetry_endpoints(
&self,
chain_spec: &Box<dyn ChainSpec + 'static, Global>
) -> Result<Option<TelemetryEndpoints>, Error>
fn telemetry_endpoints( &self, chain_spec: &Box<dyn ChainSpec + 'static, Global> ) -> Result<Option<TelemetryEndpoints>, Error>
source§fn default_heap_pages(&self) -> Result<Option<u64>, Error>
fn default_heap_pages(&self) -> Result<Option<u64>, Error>
source§fn offchain_worker(&self, role: &Role) -> Result<OffchainWorkerConfig, Error>
fn offchain_worker(&self, role: &Role) -> Result<OffchainWorkerConfig, Error>
Ok(_)
Read moreOk(true)
if authoring should be forced Read moresource§fn disable_grandpa(&self) -> Result<bool, Error>
fn disable_grandpa(&self) -> Result<bool, Error>
Ok(true)
if grandpa should be disabled Read moresource§fn dev_key_seed(&self, _is_dev: bool) -> Result<Option<String>, Error>
fn dev_key_seed(&self, _is_dev: bool) -> Result<Option<String>, Error>
source§fn tracing_targets(&self) -> Result<Option<String>, Error>
fn tracing_targets(&self) -> Result<Option<String>, Error>
source§fn tracing_receiver(&self) -> Result<TracingReceiver, Error>
fn tracing_receiver(&self) -> Result<TracingReceiver, Error>
source§fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig, Error>
fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig, Error>
source§fn max_runtime_instances(&self) -> Result<Option<usize>, Error>
fn max_runtime_instances(&self) -> Result<Option<usize>, Error>
source§fn runtime_cache_size(&self) -> Result<u8, Error>
fn runtime_cache_size(&self) -> Result<u8, Error>
source§fn announce_block(&self) -> Result<bool, Error>
fn announce_block(&self) -> Result<bool, Error>
source§fn create_configuration<C>(
&self,
cli: &C,
tokio_handle: Handle
) -> Result<Configuration, Error>where
C: SubstrateCli,
fn create_configuration<C>( &self, cli: &C, tokio_handle: Handle ) -> Result<Configuration, Error>where C: SubstrateCli,
source§fn detailed_log_output(&self) -> Result<bool, Error>
fn detailed_log_output(&self) -> Result<bool, Error>
source§fn init<F>(
&self,
support_url: &String,
impl_version: &String,
logger_hook: F,
config: &Configuration
) -> Result<(), Error>where
F: FnOnce(&mut LoggerBuilder, &Configuration),
fn init<F>( &self, support_url: &String, impl_version: &String, logger_hook: F, config: &Configuration ) -> Result<(), Error>where F: FnOnce(&mut LoggerBuilder, &Configuration),
source§impl FromArgMatches for BlockCmd
impl FromArgMatches for BlockCmd
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§impl Parser for BlockCmd
impl Parser for BlockCmd
§fn try_parse() -> Result<Self, Error<RichFormatter>>
fn try_parse() -> Result<Self, Error<RichFormatter>>
std::env::args_os()
, return Err on error.§fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Selfwhere I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error<RichFormatter>>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error<RichFormatter>>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I)where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error<RichFormatter>>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error<RichFormatter>>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Auto Trait Implementations§
impl RefUnwindSafe for BlockCmd
impl Send for BlockCmd
impl Sync for BlockCmd
impl Unpin for BlockCmd
impl UnwindSafe for BlockCmd
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.