mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
account for dependencies when showing memory usage
This commit is contained in:
parent
46d7b08c5f
commit
e40494c6c1
2 changed files with 11 additions and 0 deletions
|
@ -115,9 +115,13 @@ pub fn run(verbose: bool, memory_usage: bool, path: &Path, only: Option<&str>) -
|
||||||
println!("Analysis: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage());
|
println!("Analysis: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage());
|
||||||
|
|
||||||
if memory_usage {
|
if memory_usage {
|
||||||
|
drop(db);
|
||||||
for (name, bytes) in host.per_query_memory_usage() {
|
for (name, bytes) in host.per_query_memory_usage() {
|
||||||
println!("{:>8} {}", bytes, name)
|
println!("{:>8} {}", bytes, name)
|
||||||
}
|
}
|
||||||
|
let before = ra_prof::memory_usage();
|
||||||
|
drop(host);
|
||||||
|
println!("leftover: {}", before.allocated - ra_prof::memory_usage().allocated)
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -252,6 +252,13 @@ impl RootDatabase {
|
||||||
let q: $q = Default::default();
|
let q: $q = Default::default();
|
||||||
let name = format!("{:?}", q);
|
let name = format!("{:?}", q);
|
||||||
acc.push((name, before - after));
|
acc.push((name, before - after));
|
||||||
|
|
||||||
|
let before = memory_usage().allocated;
|
||||||
|
self.query($q).sweep(sweep.discard_everything());
|
||||||
|
let after = memory_usage().allocated;
|
||||||
|
let q: $q = Default::default();
|
||||||
|
let name = format!("{:?} (deps)", q);
|
||||||
|
acc.push((name, before - after));
|
||||||
)*}
|
)*}
|
||||||
}
|
}
|
||||||
sweep_each_query![
|
sweep_each_query![
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue