diff options
author | Jonas Schievink <[email protected]> | 2020-12-11 16:30:32 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-12-11 16:30:32 +0000 |
commit | 7fc4ba000e18c96c2c32593909114fe90e163d85 (patch) | |
tree | a435cd47fdf51add337125224394f27e114251c0 | |
parent | e68110c082abe2a16ec97f9f15ad8c9ebf73996d (diff) |
Capture memory usage metrics
-rw-r--r-- | xtask/src/metrics.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs index e0d1aaf97..42ab09eeb 100644 --- a/xtask/src/metrics.rs +++ b/xtask/src/metrics.rs | |||
@@ -3,6 +3,7 @@ use std::{ | |||
3 | env, | 3 | env, |
4 | io::Write as _, | 4 | io::Write as _, |
5 | path::Path, | 5 | path::Path, |
6 | process::{Command, Stdio}, | ||
6 | time::{Instant, SystemTime, UNIX_EPOCH}, | 7 | time::{Instant, SystemTime, UNIX_EPOCH}, |
7 | }; | 8 | }; |
8 | 9 | ||
@@ -81,7 +82,11 @@ impl Metrics { | |||
81 | } | 82 | } |
82 | fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> { | 83 | fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> { |
83 | eprintln!("\nMeasuring analysis-stats/{}", name); | 84 | eprintln!("\nMeasuring analysis-stats/{}", name); |
84 | let output = cmd!("./target/release/rust-analyzer analysis-stats --quiet {path}").read()?; | 85 | let output = Command::new("./target/release/rust-analyzer") |
86 | .args(&["analysis-stats", "--quiet", "--memory-usage", path]) | ||
87 | .stdout(Stdio::inherit()) | ||
88 | .output()?; | ||
89 | let output = String::from_utf8(output.stdout)?; | ||
85 | for (metric, value, unit) in parse_metrics(&output) { | 90 | for (metric, value, unit) in parse_metrics(&output) { |
86 | self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into()); | 91 | self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into()); |
87 | } | 92 | } |