mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
18
tracer/src/lib.rs
Normal file
18
tracer/src/lib.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright © 2022 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
mod tracer_noop;
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
pub use tracer_noop::*;
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
mod tracer;
|
||||
#[cfg(feature = "tracing")]
|
||||
pub use tracer::*;
|
||||
Reference in New Issue
Block a user