From 57896f672a214d4a2bf1f414c3f50943b8b3bf8f Mon Sep 17 00:00:00 2001 From: Jason Treloar Date: Sun, 18 Aug 2024 10:49:13 +1000 Subject: [PATCH] invert features from no-verify -> verify --- FEATURES.mkd | 7 ++++++- tracing-tracy/Cargo.toml | 2 +- tracy-client-sys/Cargo.toml | 2 +- tracy-client-sys/build.rs | 6 +++--- tracy-client/Cargo.toml | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/FEATURES.mkd b/FEATURES.mkd index 0e2057e..50ded42 100644 --- a/FEATURES.mkd +++ b/FEATURES.mkd @@ -34,7 +34,12 @@ * `demangle` - requires that the demangling function be defined by the user. See the `register_demangler!` macro for more details. Corresponds to the `TRACY_DEMANGLE` define. -* `no-verify` - disables verification that spans are closed within Tracy's C API. Enabling this significantly reduces the relative overhead and timing precision of short lived spans (<100ns) - but can cause undefined behavior if spans are not closed, when using the Rust API this would likely correspond to calling a `std::mem::forget(span)`. Corresponds to the `TRACY_NO_VERIFY` define. +* `verify` - enables verification that spans are closed within Tracy's C API. Disabling this + reduces instrumentation overhead (~50% for 0 callstack depth spans) and improves timing precision + by a proportional amount. This is most noticeable in short lived spans (<100ns) but can cause + undefined behavior if spans are not closed. When using the provided Rust APIs this can occur if a + Span's drop code is not called (e.g. `std::mem::forget(span)`). When disabled + corresponds to the `TRACY_NO_VERIFY` define. Refer to this package's `Cargo.toml` for the list of the features enabled by default. Refer to the `Tracy` manual for more information on the implications of each feature. diff --git a/tracing-tracy/Cargo.toml b/tracing-tracy/Cargo.toml index 237d3db..f8f4e4e 100644 --- a/tracing-tracy/Cargo.toml +++ b/tracing-tracy/Cargo.toml @@ -50,7 +50,7 @@ manual-lifetime = ["client/manual-lifetime"] delayed-init = ["client/delayed-init"] flush-on-exit = ["client/flush-on-exit"] demangle = ["client/demangle"] -no-verify = ["client/no-verify"] +verify = ["client/verify"] [package.metadata.docs.rs] rustdoc-args = ["--cfg", "tracing_tracy_docs"] diff --git a/tracy-client-sys/Cargo.toml b/tracy-client-sys/Cargo.toml index 45aa121..5589b3e 100644 --- a/tracy-client-sys/Cargo.toml +++ b/tracy-client-sys/Cargo.toml @@ -45,7 +45,7 @@ delayed-init = [] callstack-inlines = [] flush-on-exit = [] demangle = [] -no-verify = [] +verify = [] [package.metadata.docs.rs] all-features = true diff --git a/tracy-client-sys/build.rs b/tracy-client-sys/build.rs index df5f92e..918e7fd 100644 --- a/tracy-client-sys/build.rs +++ b/tracy-client-sys/build.rs @@ -18,9 +18,6 @@ fn set_feature_defines(mut c: cc::Build) -> cc::Build { if std::env::var_os("CARGO_FEATURE_ENABLE").is_some() { c.define("TRACY_ENABLE", None); } - if std::env::var_os("CARGO_FEATURE_NO_VERIFY").is_some() { - c.define("TRACY_NO_VERIFY", None); - } if std::env::var_os("CARGO_FEATURE_TIMER_FALLBACK").is_some() { c.define("TRACY_TIMER_FALLBACK", None); } @@ -68,6 +65,9 @@ fn set_feature_defines(mut c: cc::Build) -> cc::Build { if std::env::var_os("CARGO_FEATURE_CALLSTACK_INLINES").is_none() { c.define("TRACY_NO_CALLSTACK_INLINES", None); } + if std::env::var_os("CARGO_FEATURE_VERIFY").is_none() { + c.define("TRACY_NO_VERIFY", None); + } c } diff --git a/tracy-client/Cargo.toml b/tracy-client/Cargo.toml index c3cbb75..5d88aad 100644 --- a/tracy-client/Cargo.toml +++ b/tracy-client/Cargo.toml @@ -64,7 +64,7 @@ manual-lifetime = ["sys/manual-lifetime"] delayed-init = ["sys/delayed-init"] flush-on-exit = ["sys/flush-on-exit"] demangle = ["sys/demangle", "dep:rustc-demangle"] -no-verify = ["sys/no-verify"] +verify = ["sys/verify"] [package.metadata.docs.rs] rustdoc-args = ["--cfg", "tracy_client_docs"]