From 98cc51580d0b8a6662f0155d8a45a8cfff469d72 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 16 Feb 2020 18:04:08 +0100 Subject: Enable profiling for bench --- crates/ra_prof/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_prof/src/lib.rs') diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index d38ff397e..c0bfbc2ee 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -26,6 +26,13 @@ pub use crate::memory_usage::{Bytes, MemoryUsage}; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +pub fn init() { + set_filter(match std::env::var("RA_PROFILE") { + Ok(spec) => Filter::from_spec(&spec), + Err(_) => Filter::disabled(), + }); +} + /// Set profiling filter. It specifies descriptions allowed to profile. /// This is helpful when call stack has too many nested profiling scopes. /// Additionally filter can specify maximum depth of profiling scopes nesting. -- cgit v1.2.3