diff options
Diffstat (limited to 'crates/profile')
-rw-r--r-- | crates/profile/Cargo.toml | 5 | ||||
-rw-r--r-- | crates/profile/src/lib.rs | 15 | ||||
-rw-r--r-- | crates/profile/src/tree.rs | 4 |
3 files changed, 3 insertions, 21 deletions
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml index c5dfdff32..9c7ce26be 100644 --- a/crates/profile/Cargo.toml +++ b/crates/profile/Cargo.toml | |||
@@ -13,9 +13,7 @@ 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 } | 16 | la-arena = { version = "0.2.0", path = "../../lib/arena" } |
17 | |||
18 | arena = { path = "../arena", version = "0.0.0" } | ||
19 | 17 | ||
20 | [target.'cfg(target_os = "linux")'.dependencies] | 18 | [target.'cfg(target_os = "linux")'.dependencies] |
21 | perf-event = "0.4" | 19 | perf-event = "0.4" |
@@ -24,5 +22,4 @@ perf-event = "0.4" | |||
24 | cpu_profiler = [] | 22 | cpu_profiler = [] |
25 | 23 | ||
26 | # Uncomment to enable for the whole crate graph | 24 | # Uncomment to enable for the whole crate graph |
27 | # default = [ "backtrace" ] | ||
28 | # default = [ "cpu_profiler" ] | 25 | # 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 |
diff --git a/crates/profile/src/tree.rs b/crates/profile/src/tree.rs index 3fac1f36c..62f0c30b5 100644 --- a/crates/profile/src/tree.rs +++ b/crates/profile/src/tree.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! A simple tree implementation which tries to not allocate all over the place. | 1 | //! A simple tree implementation which tries to not allocate all over the place. |
2 | use std::ops; | 2 | use std::ops; |
3 | 3 | ||
4 | use arena::Arena; | 4 | use la_arena::Arena; |
5 | 5 | ||
6 | #[derive(Default)] | 6 | #[derive(Default)] |
7 | pub(crate) struct Tree<T> { | 7 | pub(crate) struct Tree<T> { |
@@ -9,7 +9,7 @@ pub(crate) struct Tree<T> { | |||
9 | current_path: Vec<(Idx<T>, Option<Idx<T>>)>, | 9 | current_path: Vec<(Idx<T>, Option<Idx<T>>)>, |
10 | } | 10 | } |
11 | 11 | ||
12 | pub(crate) type Idx<T> = arena::Idx<Node<T>>; | 12 | pub(crate) type Idx<T> = la_arena::Idx<Node<T>>; |
13 | 13 | ||
14 | impl<T> Tree<T> { | 14 | impl<T> Tree<T> { |
15 | pub(crate) fn start(&mut self) | 15 | pub(crate) fn start(&mut self) |