diff options
Diffstat (limited to 'crates/profile')
-rw-r--r-- | crates/profile/src/hprof.rs | 4 | ||||
-rw-r--r-- | crates/profile/src/tree.rs | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/crates/profile/src/hprof.rs b/crates/profile/src/hprof.rs index 934cc8e37..8957ea016 100644 --- a/crates/profile/src/hprof.rs +++ b/crates/profile/src/hprof.rs | |||
@@ -27,7 +27,7 @@ pub fn init_from(spec: &str) { | |||
27 | filter.install(); | 27 | filter.install(); |
28 | } | 28 | } |
29 | 29 | ||
30 | pub type Label = &'static str; | 30 | type Label = &'static str; |
31 | 31 | ||
32 | /// This function starts a profiling scope in the current execution stack with a given description. | 32 | /// This function starts a profiling scope in the current execution stack with a given description. |
33 | /// It returns a `Profile` struct that measures elapsed time between this method invocation and `Profile` struct drop. | 33 | /// It returns a `Profile` struct that measures elapsed time between this method invocation and `Profile` struct drop. |
@@ -173,7 +173,7 @@ impl ProfileStack { | |||
173 | true | 173 | true |
174 | } | 174 | } |
175 | 175 | ||
176 | pub fn pop(&mut self, label: Label, detail: Option<String>) { | 176 | fn pop(&mut self, label: Label, detail: Option<String>) { |
177 | let start = self.starts.pop().unwrap(); | 177 | let start = self.starts.pop().unwrap(); |
178 | let duration = start.elapsed(); | 178 | let duration = start.elapsed(); |
179 | self.messages.finish(Message { duration, label, detail }); | 179 | self.messages.finish(Message { duration, label, detail }); |
diff --git a/crates/profile/src/tree.rs b/crates/profile/src/tree.rs index 096f58511..3fac1f36c 100644 --- a/crates/profile/src/tree.rs +++ b/crates/profile/src/tree.rs | |||
@@ -4,15 +4,15 @@ use std::ops; | |||
4 | use arena::Arena; | 4 | use arena::Arena; |
5 | 5 | ||
6 | #[derive(Default)] | 6 | #[derive(Default)] |
7 | pub struct Tree<T> { | 7 | pub(crate) struct Tree<T> { |
8 | nodes: Arena<Node<T>>, | 8 | nodes: Arena<Node<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 type Idx<T> = arena::Idx<Node<T>>; | 12 | pub(crate) type Idx<T> = arena::Idx<Node<T>>; |
13 | 13 | ||
14 | impl<T> Tree<T> { | 14 | impl<T> Tree<T> { |
15 | pub fn start(&mut self) | 15 | pub(crate) fn start(&mut self) |
16 | where | 16 | where |
17 | T: Default, | 17 | T: Default, |
18 | { | 18 | { |
@@ -30,19 +30,19 @@ impl<T> Tree<T> { | |||
30 | self.current_path.push((me, None)); | 30 | self.current_path.push((me, None)); |
31 | } | 31 | } |
32 | 32 | ||
33 | pub fn finish(&mut self, data: T) { | 33 | pub(crate) fn finish(&mut self, data: T) { |
34 | let (me, _last_child) = self.current_path.pop().unwrap(); | 34 | let (me, _last_child) = self.current_path.pop().unwrap(); |
35 | self.nodes[me].data = data; | 35 | self.nodes[me].data = data; |
36 | } | 36 | } |
37 | 37 | ||
38 | pub fn root(&self) -> Option<Idx<T>> { | 38 | pub(crate) fn root(&self) -> Option<Idx<T>> { |
39 | self.nodes.iter().next().map(|(idx, _)| idx) | 39 | self.nodes.iter().next().map(|(idx, _)| idx) |
40 | } | 40 | } |
41 | 41 | ||
42 | pub fn children(&self, idx: Idx<T>) -> impl Iterator<Item = Idx<T>> + '_ { | 42 | pub(crate) fn children(&self, idx: Idx<T>) -> impl Iterator<Item = Idx<T>> + '_ { |
43 | NodeIter { nodes: &self.nodes, next: self.nodes[idx].first_child } | 43 | NodeIter { nodes: &self.nodes, next: self.nodes[idx].first_child } |
44 | } | 44 | } |
45 | pub fn clear(&mut self) { | 45 | pub(crate) fn clear(&mut self) { |
46 | self.nodes.clear(); | 46 | self.nodes.clear(); |
47 | self.current_path.clear(); | 47 | self.current_path.clear(); |
48 | } | 48 | } |
@@ -55,7 +55,7 @@ impl<T> ops::Index<Idx<T>> for Tree<T> { | |||
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | pub struct Node<T> { | 58 | pub(crate) struct Node<T> { |
59 | data: T, | 59 | data: T, |
60 | first_child: Option<Idx<T>>, | 60 | first_child: Option<Idx<T>>, |
61 | next_sibling: Option<Idx<T>>, | 61 | next_sibling: Option<Idx<T>>, |