diff --git a/air/src/farewell_step/outcome.rs b/air/src/farewell_step/outcome.rs index 1e49cc07..b327a084 100644 --- a/air/src/farewell_step/outcome.rs +++ b/air/src/farewell_step/outcome.rs @@ -78,7 +78,7 @@ pub(crate) fn from_execution_error( populate_outcome_from_contexts(exec_ctx, trace_handler, error.to_error_code(), error.to_string()) } -#[tracing::instrument(skip(exec_ctx, trace_handler))] +#[tracing::instrument(skip(exec_ctx, trace_handler), level = "info")] fn populate_outcome_from_contexts( exec_ctx: ExecutionCtx<'_>, trace_handler: TraceHandler, @@ -94,13 +94,13 @@ fn populate_outcome_from_contexts( ); let data = measure!( serde_json::to_vec(&data).expect("default serializer shouldn't fail"), - tracing::Level::INFO, + tracing::Level::TRACE, "serde_json::to_vec(data)" ); let next_peer_pks = dedup(exec_ctx.next_peer_pks); let call_requests = measure!( serde_json::to_vec(&exec_ctx.call_requests).expect("default serializer shouldn't fail"), - tracing::Level::INFO, + tracing::Level::TRACE, "serde_json::to_vec(call_results)", ); diff --git a/crates/air-lib/interpreter-data/src/interpreter_data.rs b/crates/air-lib/interpreter-data/src/interpreter_data.rs index b739d4a9..b759deef 100644 --- a/crates/air-lib/interpreter-data/src/interpreter_data.rs +++ b/crates/air-lib/interpreter-data/src/interpreter_data.rs @@ -65,7 +65,6 @@ impl InterpreterData { } } - #[tracing::instrument(skip_all)] pub fn from_execution_result( trace: ExecutionTrace, streams: GlobalStreamGens, diff --git a/tools/cli/air-trace/README.md b/tools/cli/air-trace/README.md index dab96279..aa53ae59 100644 --- a/tools/cli/air-trace/README.md +++ b/tools/cli/air-trace/README.md @@ -14,7 +14,8 @@ All common parameters are optional. Their position is before the mode selector + `--max-heap-size N` defines maximum heap size for WASM runtime. + `--interpreter PATH` option defines the AquaVM WASM binary to be executed. By default, it is "target/wasm32-wasi/release/air_interpreter_server.wasm", but you can define a global value with the `AIR_INTERPRETER_WASM_PATH` environment variable. The default presumes that the tool is run from the root of this repository. Feel free to use option or environment variable to run from any location. + with the `--json` option, tracing info is output (to stderr) in machine-readable JSON format. The output can be later processed with `air-trace stats` subcommand. -+ `--tracing-params` defines tracing crate logging levels. By default, it is equal to `info` and does trace the most high-level AquaVM constructions (data parsing, AIR script parsing, execution, result construction). With `debug` level it traces some individual commands, and with `trace` level it traces even more fine grained functionality. ++ `--tracing-params` defines tracing logging levels for AquaVM. By default, it is equal to `info` and does trace the most high-level AquaVM constructions (data parsing, AIR script parsing, execution). With `debug` level it traces some individual commands, and with `trace` level it traces even more fine grained functionality, but it induce more overhead. ++ `--runner-tracing-params` defines tracing logging level for the runner. By default, it is equal to `warn`. The important option is `--native`. It runs the AquaVM as the native code that can be profiled with any native profiler. As input data deserialization and serialization time can be comparable to particle execution time, and short execution times provides less reliable results, one can use `--repeat N` option to repeat particle execution several times. Execution result is not printed in this case, so you may run `--repeat 1` to suppress it. diff --git a/tools/cli/air-trace/src/run.rs b/tools/cli/air-trace/src/run.rs index 34d715fd..e5f8fdc6 100644 --- a/tools/cli/air-trace/src/run.rs +++ b/tools/cli/air-trace/src/run.rs @@ -41,6 +41,8 @@ pub(crate) struct Args { max_heap_size: Option, #[clap(long, default_value = "info")] tracing_params: String, + #[clap(long, default_value = "warn")] + runner_tracing_params: String, #[clap(long)] native: bool, #[clap( @@ -69,7 +71,13 @@ enum Source { pub(crate) fn run(args: Args) -> anyhow::Result<()> { let tracing_json = (!args.json) as u8; - init_tracing(args.tracing_params.clone(), tracing_json); + let global_tracing_params = if args.native { + // for native, there is single tracing configuration, and no runner + args.tracing_params.clone() + } else { + args.runner_tracing_params + }; + init_tracing(global_tracing_params, tracing_json); let current_peer_id = args.current_peer_id.as_deref().unwrap_or("some_id"); let mut runner = get_runner( diff --git a/tools/cli/air-trace/src/run/data/plain.rs b/tools/cli/air-trace/src/run/data/plain.rs index 5a4d4793..27cb4b69 100644 --- a/tools/cli/air-trace/src/run/data/plain.rs +++ b/tools/cli/air-trace/src/run/data/plain.rs @@ -22,8 +22,7 @@ use anyhow::Context; use std::path::{Path, PathBuf}; -const DEFAULT_DATA: &str = - r#"{"trace":[],"streams":{},"version":"0.2.2","lcid":0,"r_streams":{"$nodes":{}}}"#; +const DEFAULT_DATA: &str = ""; #[derive(clap::Args, Debug)] pub(crate) struct PlainDataArgs {