Files
oak-gpui/crates/ztracing/src/lib.rs
T
David Kleingeldandlocalcc b558be7ec6 adds tracing for instrumenting non-async functions (#44147)
Tracing code is not included in normal release builds
Documents how to use them in our performance docs
Only the maps and cursors are instrumented atm

# Compile times:
current main: fresh release build (cargo clean then build --release)
377.34 secs
current main: fresh debug build (cargo clean then build )
89.31 secs

tracing tracy: fresh release build (cargo clean then build --release)
374.84 secs
tracing tracy: fresh debug build (cargo clean then build )
88.95 secs

tracing tracy: fresh release build with timings (cargo clean then build
--release --features tracing)
375.77 secs
tracing tracy: fresh debug build with timings (cargo clean then build
--features tracing)
90.03 secs


Release Notes:

- N/A

---------

Co-authored-by: localcc <work@localcc.cc>
2025-12-05 17:23:06 +00:00

17 lines
388 B
Rust

#[cfg(ztracing)]
pub use tracing::instrument;
#[cfg(not(ztracing))]
pub use ztracing_macro::instrument;
#[cfg(ztracing)]
pub fn init() {
use tracing_subscriber::prelude::*;
tracing::subscriber::set_global_default(
tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default()),
)
.expect("setup tracy layer");
}
#[cfg(not(ztracing))]
pub fn init() {}