Skip to content

Commit f01e7e3

Browse files
author
Jonas Schievink
committed
Track VFS and remaining/unaccounted memory
1 parent 93d0ac7 commit f01e7e3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,22 @@ pub fn analysis_stats(
273273
println!("Total: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage());
274274

275275
if memory_usage {
276-
for (name, bytes) in host.per_query_memory_usage() {
277-
println!("{:>8} {}", bytes, name)
278-
}
276+
let mut mem = host.per_query_memory_usage();
277+
278+
let before = ra_prof::memory_usage();
279+
drop(vfs);
280+
let vfs = before.allocated - ra_prof::memory_usage().allocated;
281+
mem.push(("VFS".into(), vfs));
282+
279283
let before = ra_prof::memory_usage();
280284
drop(host);
281-
println!("leftover: {}", before.allocated - ra_prof::memory_usage().allocated)
285+
mem.push(("Unaccounted".into(), before.allocated - ra_prof::memory_usage().allocated));
286+
287+
mem.push(("Remaining".into(), ra_prof::memory_usage().allocated));
288+
289+
for (name, bytes) in mem {
290+
println!("{:>8} {}", bytes, name)
291+
}
282292
}
283293

284294
Ok(())

0 commit comments

Comments
 (0)