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

@@ -12,6 +12,7 @@ guest_debug = ["kvm"]
kvm = ["hypervisor/kvm", "vfio-ioctls/kvm", "vm-device/kvm", "pci/kvm"]
mshv = ["hypervisor/mshv", "vfio-ioctls/mshv", "vm-device/mshv", "pci/mshv"]
tdx = ["arch/tdx", "hypervisor/tdx"]
tracing = ["tracer/tracing"]
[dependencies]
acpi_tables = { path = "../acpi_tables" }
@@ -42,6 +43,7 @@ serde_json = "1.0.85"
serial_buffer = { path = "../serial_buffer" }
signal-hook = "0.3.14"
thiserror = "1.0.35"
tracer = { path = "../tracer" }
uuid = "1.1.2"
versionize = "0.1.6"
versionize_derive = "0.1.4"