aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/metrics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/metrics.rs')
-rw-r--r--xtask/src/metrics.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs
index 624ad3b7e..72de92c64 100644
--- a/xtask/src/metrics.rs
+++ b/xtask/src/metrics.rs
@@ -9,14 +9,12 @@ use std::{
9use anyhow::{bail, format_err, Result}; 9use anyhow::{bail, format_err, Result};
10use xshell::{cmd, mkdir_p, pushd, pushenv, read_file, rm_rf}; 10use xshell::{cmd, mkdir_p, pushd, pushenv, read_file, rm_rf};
11 11
12type Unit = String; 12use crate::flags;
13 13
14pub struct MetricsCmd { 14type Unit = String;
15 pub dry_run: bool,
16}
17 15
18impl MetricsCmd { 16impl flags::Metrics {
19 pub fn run(self) -> Result<()> { 17 pub(crate) fn run(self) -> Result<()> {
20 let mut metrics = Metrics::new()?; 18 let mut metrics = Metrics::new()?;
21 if !self.dry_run { 19 if !self.dry_run {
22 rm_rf("./target/release")?; 20 rm_rf("./target/release")?;
@@ -82,7 +80,7 @@ impl Metrics {
82 fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> { 80 fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> {
83 eprintln!("\nMeasuring analysis-stats/{}", name); 81 eprintln!("\nMeasuring analysis-stats/{}", name);
84 let output = 82 let output =
85 cmd!("./target/release/rust-analyzer analysis-stats --quiet --memory-usage {path}") 83 cmd!("./target/release/rust-analyzer --quiet analysis-stats --memory-usage {path}")
86 .read()?; 84 .read()?;
87 for (metric, value, unit) in parse_metrics(&output) { 85 for (metric, value, unit) in parse_metrics(&output) {
88 self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into()); 86 self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into());