From 4dd7faed3400c8ed204c6879258707ce6f7a90d4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Jun 2019 10:41:47 +0300 Subject: apply profile filter to top-level entries only --- crates/ra_prof/src/lib.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/ra_prof') diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 031405879..e681b8e0b 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -76,17 +76,16 @@ pub fn profile(desc: &str) -> Profiler { } }; } - if stack.starts.len() > stack.filter_data.depth { return Profiler { desc: None }; } - - if stack.filter_data.allowed.is_empty() || stack.filter_data.allowed.contains(desc) { - stack.starts.push(Instant::now()); - Profiler { desc: Some(desc.to_string()) } - } else { - Profiler { desc: None } + let allowed = &stack.filter_data.allowed; + if stack.starts.is_empty() && !allowed.is_empty() && !allowed.contains(desc) { + return Profiler { desc: None }; } + + stack.starts.push(Instant::now()); + Profiler { desc: Some(desc.to_string()) } }) } -- cgit v1.2.3