From 764dcefa9f3af82833271c144879330dfc5c99e1 Mon Sep 17 00:00:00 2001 From: mornyx Date: Fri, 20 May 2022 10:02:52 +0800 Subject: [PATCH 1/3] Optimize mutually exclusive features Signed-off-by: mornyx --- Cargo.toml | 11 ++++------- README.md | 1 - src/backtrace/mod.rs | 10 ++++++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b5d601a3..43a40fe2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,21 +10,18 @@ documentation = "https://docs.rs/pprof/" readme = "README.md" [features] -default = ["cpp", "backtrace-rs"] +default = ["cpp"] +cpp = ["symbolic-demangle/cpp"] flamegraph = ["inferno"] +frame-pointer = [] # A private feature to indicate either prost-codec or protobuf-codec is enabled. _protobuf = [] prost-codec = ["prost", "prost-derive", "prost-build", "_protobuf"] protobuf-codec = ["protobuf", "protobuf-codegen-pure", "_protobuf"] -backtrace-rs = ["backtrace"] -frame-pointer = ["backtrace"] - -cpp = ["symbolic-demangle/cpp"] - [dependencies] -backtrace = { version = "0.3", optional = true } +backtrace = { version = "0.3" } once_cell = "1.9" libc = "^0.2.66" log = "0.4" diff --git a/README.md b/README.md index 3529b3c0..156ff5bb 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ FRAME: backtrace::backtrace::trace::h3e91a3123a3049a5 -> FRAME: pprof::profiler: - `flamegraph` enables the flamegraph report format. - `prost-codec` enables the pprof protobuf report format through `prost`. - `protobuf-codec` enables the pprof protobuf report format through `protobuf` crate. -- `backtrace-rs` unwind the backtrace through `backtrace-rs` (which calls the `Unwind_Backtrace`). - `frame-pointer` gets the backtrace through frame pointer. **only available for nightly** ## Flamegraph diff --git a/src/backtrace/mod.rs b/src/backtrace/mod.rs index f838e858..44cd3214 100644 --- a/src/backtrace/mod.rs +++ b/src/backtrace/mod.rs @@ -44,9 +44,15 @@ pub trait Trace { Self: Sized; } -#[cfg(feature = "backtrace-rs")] +#[cfg(not(all( + any(target_arch = "x86_64", target_arch = "aarch64"), + feature = "frame-pointer" +)))] mod backtrace_rs; -#[cfg(feature = "backtrace-rs")] +#[cfg(not(all( + any(target_arch = "x86_64", target_arch = "aarch64"), + feature = "frame-pointer" +)))] pub use backtrace_rs::Trace as TraceImpl; #[cfg(all( From 0b7fb52e973b721157b1e3ab4c785addebdd735e Mon Sep 17 00:00:00 2001 From: mornyx Date: Fri, 20 May 2022 12:01:18 +0800 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: mornyx --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc29823f..3b9b1994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Remove `backtrace-rs` feature, as the default choice when not specified (#130) + ## [0.9.1] - 2022-05-19 ### Fixed From b94189f97a9440c7d6b61976dd62f3be66e36f49 Mon Sep 17 00:00:00 2001 From: mornyx Date: Fri, 20 May 2022 12:07:10 +0800 Subject: [PATCH 3/3] Remove empty line Signed-off-by: mornyx --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b9b1994..10b68860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - - Remove `backtrace-rs` feature, as the default choice when not specified (#130) ## [0.9.1] - 2022-05-19