tracing: Tracing infrastructure

Add a new feature "tracing" that enables tracing functionality via the
"tracer" crate (sadly features and crates cannot share the same name.)

Setup: tracer::start()

The main functionality is a tracer::trace_scope()! macro that will add
trace points for the duration of the scope. Tracing events are per
thread.

Finish: tracer::end() this will write the trace file (pretty printed
JSON) to a file in the current directory.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2022-06-21 15:01:26 +01:00
parent 56f163170c
commit b35e6f3018
7 changed files with 238 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ seccompiler = "0.3.0"
serde_json = "1.0.85"
signal-hook = "0.3.14"
thiserror = "1.0.35"
tracer = { path = "tracer" }
vmm = { path = "vmm" }
vmm-sys-util = "0.10.0"
vm-memory = "0.9.0"
@@ -62,6 +63,7 @@ guest_debug = ["vmm/guest_debug"]
kvm = ["vmm/kvm"]
mshv = ["vmm/mshv"]
tdx = ["vmm/tdx"]
tracing = ["vmm/tracing", "tracer/tracing"]
[workspace]
members = [
@@ -81,6 +83,7 @@ members = [
"rate_limiter",
"serial_buffer",
"test_infra",
"tracer",
"vfio_user",
"vhdx",
"vhost_user_block",