aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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(())