Add instrumentation, with performance profiling capability (#4132)

* Implement instrumentation for performance profiling

* Add profiling to runtime functions declared in `decl_module` inc.
`on_initialize` and `on_finalize`

* Remove changes

* add docs, tidy up

* fix versions

* fix copyright date

* switch to hashmap and instant

* update example

* update example

* implement receiver for logger and make default

* fix comment

* use `if_std!` macro

* remove whitespace

* fix whitespace

* fix nits
This commit is contained in:
mattrutherford
2019-11-22 14:21:36 +00:00
committed by Gavin Wood
parent 082c58176e
commit 9cc16e539e
14 changed files with 382 additions and 11 deletions
+32
View File
@@ -259,6 +259,24 @@ pub struct TransactionPoolParams {
pub pool_kbytes: usize,
}
arg_enum! {
#[allow(missing_docs)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum TracingReceiver {
Log,
Telemetry,
}
}
impl Into<substrate_tracing::TracingReceiver> for TracingReceiver {
fn into(self) -> substrate_tracing::TracingReceiver {
match self {
TracingReceiver::Log => substrate_tracing::TracingReceiver::Log,
TracingReceiver::Telemetry => substrate_tracing::TracingReceiver::Telemetry,
}
}
}
/// Execution strategies parameters.
#[derive(Debug, StructOpt, Clone)]
pub struct ExecutionStrategies {
@@ -491,6 +509,20 @@ pub struct RunCmd {
#[structopt(long = "force-authoring")]
pub force_authoring: bool,
/// Comma separated list of targets for tracing
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
pub tracing_targets: Option<String>,
/// Receiver to process tracing messages
#[structopt(
long = "tracing-receiver",
value_name = "RECEIVER",
possible_values = &TracingReceiver::variants(),
case_insensitive = true,
default_value = "Log"
)]
pub tracing_receiver: TracingReceiver,
/// Specify custom keystore path.
#[structopt(long = "keystore-path", value_name = "PATH", parse(from_os_str))]
pub keystore_path: Option<PathBuf>,