diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-14 11:56:01 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-14 11:56:01 +0000 |
commit | 022d031b7fe9266ad3dd320c729989e8bf495b67 (patch) | |
tree | e8467dbbdcc43f4b119ea8f4485d0738a5a2577d /crates/profile | |
parent | 947850c2d9e2fa832516e3486efa0dd9c4d30e73 (diff) | |
parent | 865e05b5b47d3e27e8fe4458662e751e492a0f51 (diff) |
Merge #7266
7266: Make printin the backtrace more convenient r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/profile')
-rw-r--r-- | crates/profile/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/profile/src/lib.rs | 15 |
2 files changed, 0 insertions, 17 deletions
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml index c5dfdff32..4951f1835 100644 --- a/crates/profile/Cargo.toml +++ b/crates/profile/Cargo.toml | |||
@@ -13,7 +13,6 @@ doctest = false | |||
13 | once_cell = "1.3.1" | 13 | once_cell = "1.3.1" |
14 | cfg-if = "1" | 14 | cfg-if = "1" |
15 | libc = "0.2.73" | 15 | libc = "0.2.73" |
16 | backtrace = { version = "0.3.44", optional = true } | ||
17 | 16 | ||
18 | arena = { path = "../arena", version = "0.0.0" } | 17 | arena = { path = "../arena", version = "0.0.0" } |
19 | 18 | ||
@@ -24,5 +23,4 @@ perf-event = "0.4" | |||
24 | cpu_profiler = [] | 23 | cpu_profiler = [] |
25 | 24 | ||
26 | # Uncomment to enable for the whole crate graph | 25 | # Uncomment to enable for the whole crate graph |
27 | # default = [ "backtrace" ] | ||
28 | # default = [ "cpu_profiler" ] | 26 | # default = [ "cpu_profiler" ] |
diff --git a/crates/profile/src/lib.rs b/crates/profile/src/lib.rs index ab19271c7..aa6ccc36c 100644 --- a/crates/profile/src/lib.rs +++ b/crates/profile/src/lib.rs | |||
@@ -15,21 +15,6 @@ pub use crate::{ | |||
15 | stop_watch::{StopWatch, StopWatchSpan}, | 15 | stop_watch::{StopWatch, StopWatchSpan}, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | /// Prints backtrace to stderr, useful for debugging. | ||
19 | #[cfg(feature = "backtrace")] | ||
20 | pub fn print_backtrace() { | ||
21 | let bt = backtrace::Backtrace::new(); | ||
22 | eprintln!("{:?}", bt); | ||
23 | } | ||
24 | #[cfg(not(feature = "backtrace"))] | ||
25 | pub fn print_backtrace() { | ||
26 | eprintln!( | ||
27 | r#"enable the backtrace feature: | ||
28 | profile = {{ path = "../profile", features = [ "backtrace"] }} | ||
29 | "# | ||
30 | ); | ||
31 | } | ||
32 | |||
33 | thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false)); | 18 | thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false)); |
34 | 19 | ||
35 | /// Allows to check if the current code is withing some dynamic scope, can be | 20 | /// Allows to check if the current code is withing some dynamic scope, can be |