mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Enable profiling for bench
This commit is contained in:
parent
b98967d765
commit
98cc51580d
3 changed files with 10 additions and 6 deletions
|
@ -20,6 +20,8 @@ pub(crate) enum Op {
|
|||
}
|
||||
|
||||
pub(crate) fn run(verbose: bool, path: &Path, op: Op) -> Result<()> {
|
||||
ra_prof::init();
|
||||
|
||||
let start = Instant::now();
|
||||
eprint!("loading: ");
|
||||
let (mut host, roots) = ra_batch::load_cargo(path)?;
|
||||
|
|
|
@ -15,13 +15,8 @@ fn main() -> Result<()> {
|
|||
|
||||
fn setup_logging() -> Result<()> {
|
||||
std::env::set_var("RUST_BACKTRACE", "short");
|
||||
|
||||
env_logger::try_init()?;
|
||||
|
||||
ra_prof::set_filter(match std::env::var("RA_PROFILE") {
|
||||
Ok(spec) => ra_prof::Filter::from_spec(&spec),
|
||||
Err(_) => ra_prof::Filter::disabled(),
|
||||
});
|
||||
ra_prof::init();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue