aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-07 12:00:04 +0100
committerGitHub <[email protected]>2020-07-07 12:00:04 +0100
commit73e972a173523fd37224c1b6649e0690d2fcdbec (patch)
tree563aa911598649e4c4a1f5719b5fe63a863f14a8 /crates/ra_ide_db/src
parent0719f2824c01839c19fee944e9f15d15409d74d4 (diff)
parentf44c4b61e131284287b24dea6da6324cbe9cb252 (diff)
Merge #5244
5244: Add a command to compute memory usage statistics r=matklad a=jonas-schievink This allows inspecting memory usage on a live rust-analyzer instance after it has been used interactively. This will only work with `--features jemalloc`, so maybe it should print something more useful when that's not available? Right now it will just print 0 Bytes for every query. Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_ide_db/src')
-rw-r--r--crates/ra_ide_db/src/change.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs
index d8da3f949..84c6f40ff 100644
--- a/crates/ra_ide_db/src/change.rs
+++ b/crates/ra_ide_db/src/change.rs
@@ -164,6 +164,15 @@ impl RootDatabase {
164 hir::db::BodyQuery.in_db(self).sweep(sweep); 164 hir::db::BodyQuery.in_db(self).sweep(sweep);
165 } 165 }
166 166
167 // Feature: Memory Usage
168 //
169 // Clears rust-analyzer's internal database and prints memory usage statistics.
170 //
171 // |===
172 // | Editor | Action Name
173 //
174 // | VS Code | **Rust Analyzer: Memory Usage (Clears Database)**
175 // |===
167 pub fn per_query_memory_usage(&mut self) -> Vec<(String, Bytes)> { 176 pub fn per_query_memory_usage(&mut self) -> Vec<(String, Bytes)> {
168 let mut acc: Vec<(String, Bytes)> = vec![]; 177 let mut acc: Vec<(String, Bytes)> = vec![];
169 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); 178 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();