tracing: Add noop tracing

BUG=b:213154559
TEST=presubmit
Change-Id: Idfe23544c8381e664d913c4a80742f4e25a30006

Change-Id: I2bb0b59098ae183c45e92fcf15e1bcfe834df204
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3707622
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
This commit is contained in:
Vikram Auradkar 2022-06-16 00:19:18 +00:00 committed by Chromeos LUCI
parent a059bff152
commit 13313d403a
4 changed files with 41 additions and 0 deletions

View file

@ -76,6 +76,7 @@ members = [
"serde_keyvalue",
"tpm2",
"tpm2-sys",
"tracing",
"usb_sys",
"usb_util",
"vfio_sys",

9
tracing/Cargo.toml Normal file
View file

@ -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]

8
tracing/src/lib.rs Normal file
View file

@ -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::*;

23
tracing/src/noop.rs Normal file
View file

@ -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<bool>
};
}
#[macro_export]
macro_rules! trace_event_begin {
($category:ident, $name:expr) => {};
}
#[macro_export]
macro_rules! trace_event_end {
($category:ident) => {};
}
pub fn init() {}