mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 23:20:18 +00:00
Adjust air-trace options (#289)
1. Introduce --runner-tracing-params for enable and disable tracing of runner. 2. Adjust some function's tracing levels to make default traces less noisy.
This commit is contained in:
parent
52f0390eb8
commit
0c387f7415
@ -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)",
|
||||
);
|
||||
|
||||
|
@ -65,7 +65,6 @@ impl InterpreterData {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn from_execution_result(
|
||||
trace: ExecutionTrace,
|
||||
streams: GlobalStreamGens,
|
||||
|
@ -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.
|
||||
|
||||
|
@ -41,6 +41,8 @@ pub(crate) struct Args {
|
||||
max_heap_size: Option<u64>,
|
||||
#[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(
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user