Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize mutually exclusive features #130

Merged
merged 3 commits into from May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,9 @@ 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
Expand Down
11 changes: 4 additions & 7 deletions Cargo.toml
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions src/backtrace/mod.rs
Expand Up @@ -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(
Expand Down