aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-07-03 16:16:01 +0100
committerJonas Schievink <[email protected]>2020-07-03 16:16:01 +0100
commitf01e7e3601423e176e16c66aebbe6aca541a5731 (patch)
tree06aecf32eb7f434d9fee444c159d7085437d4a2f
parent93d0ac7fa0a5a9548ac07e22ac14eee46550172c (diff)
Track VFS and remaining/unaccounted memory
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 14982919d..846264046 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -273,12 +273,22 @@ pub fn analysis_stats(
273 println!("Total: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage()); 273 println!("Total: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage());
274 274
275 if memory_usage { 275 if memory_usage {
276 for (name, bytes) in host.per_query_memory_usage() { 276 let mut mem = host.per_query_memory_usage();
277 println!("{:>8} {}", bytes, name) 277
278 } 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
279 let before = ra_prof::memory_usage(); 283 let before = ra_prof::memory_usage();
280 drop(host); 284 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 }
282 } 292 }
283 293
284 Ok(()) 294 Ok(())