diff --git a/Cargo.toml b/Cargo.toml index f2bf223a76..bae7ef373f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,6 +76,7 @@ members = [ "serde_keyvalue", "tpm2", "tpm2-sys", + "tracing", "usb_sys", "usb_util", "vfio_sys", diff --git a/tracing/Cargo.toml b/tracing/Cargo.toml new file mode 100644 index 0000000000..784508d510 --- /dev/null +++ b/tracing/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "tracing" +version = "0.1.0" +authors = ["The Chromium OS Authors"] +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] \ No newline at end of file diff --git a/tracing/src/lib.rs b/tracing/src/lib.rs new file mode 100644 index 0000000000..bdcf0b0f14 --- /dev/null +++ b/tracing/src/lib.rs @@ -0,0 +1,8 @@ +// Copyright 2022 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// A crate that provides noop tracing. +mod noop; + +pub use noop::*; diff --git a/tracing/src/noop.rs b/tracing/src/noop.rs new file mode 100644 index 0000000000..6a04d2f2c6 --- /dev/null +++ b/tracing/src/noop.rs @@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Empty macros for when the tracing feature isn't used. +#[macro_export] +macro_rules! trace_event { + ($category:ident, $name:expr) => { + None as Option + }; +} + +#[macro_export] +macro_rules! trace_event_begin { + ($category:ident, $name:expr) => {}; +} + +#[macro_export] +macro_rules! trace_event_end { + ($category:ident) => {}; +} + +pub fn init() {}