summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-analyzer/xtask
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/tools/rust-analyzer/xtask
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rust-analyzer/xtask')
-rw-r--r--src/tools/rust-analyzer/xtask/src/flags.rs20
-rw-r--r--src/tools/rust-analyzer/xtask/src/metrics.rs65
2 files changed, 45 insertions, 40 deletions
diff --git a/src/tools/rust-analyzer/xtask/src/flags.rs b/src/tools/rust-analyzer/xtask/src/flags.rs
index 7720ad69f..e52cbfca3 100644
--- a/src/tools/rust-analyzer/xtask/src/flags.rs
+++ b/src/tools/rust-analyzer/xtask/src/flags.rs
@@ -114,6 +114,7 @@ pub enum MeasurementType {
AnalyzeRipgrep,
AnalyzeWebRender,
AnalyzeDiesel,
+ AnalyzeHyper,
}
impl FromStr for MeasurementType {
@@ -122,13 +123,26 @@ impl FromStr for MeasurementType {
match s {
"build" => Ok(Self::Build),
"self" => Ok(Self::AnalyzeSelf),
- "ripgrep" => Ok(Self::AnalyzeRipgrep),
- "webrender" => Ok(Self::AnalyzeWebRender),
- "diesel" => Ok(Self::AnalyzeDiesel),
+ "ripgrep-13.0.0" => Ok(Self::AnalyzeRipgrep),
+ "webrender-2022" => Ok(Self::AnalyzeWebRender),
+ "diesel-1.4.8" => Ok(Self::AnalyzeDiesel),
+ "hyper-0.14.18" => Ok(Self::AnalyzeHyper),
_ => Err("Invalid option".to_string()),
}
}
}
+impl AsRef<str> for MeasurementType {
+ fn as_ref(&self) -> &str {
+ match self {
+ Self::Build => "build",
+ Self::AnalyzeSelf => "self",
+ Self::AnalyzeRipgrep => "ripgrep-13.0.0",
+ Self::AnalyzeWebRender => "webrender-2022",
+ Self::AnalyzeDiesel => "diesel-1.4.8",
+ Self::AnalyzeHyper => "hyper-0.14.18",
+ }
+ }
+}
#[derive(Debug)]
pub struct Metrics {
diff --git a/src/tools/rust-analyzer/xtask/src/metrics.rs b/src/tools/rust-analyzer/xtask/src/metrics.rs
index 685374231..59d41d8e4 100644
--- a/src/tools/rust-analyzer/xtask/src/metrics.rs
+++ b/src/tools/rust-analyzer/xtask/src/metrics.rs
@@ -29,46 +29,38 @@ impl flags::Metrics {
let _env = sh.push_env("RA_METRICS", "1");
- let filename = match self.measurement_type {
- Some(ms) => match ms {
- MeasurementType::Build => {
- metrics.measure_build(sh)?;
- "build.json"
- }
- MeasurementType::AnalyzeSelf => {
- metrics.measure_analysis_stats_self(sh)?;
- "self.json"
- }
- MeasurementType::AnalyzeRipgrep => {
- metrics.measure_analysis_stats(sh, "ripgrep")?;
- "ripgrep.json"
- }
- MeasurementType::AnalyzeWebRender => {
- {
- // https://github.com/rust-lang/rust-analyzer/issues/9997
- let _d = sh.push_dir("target/rustc-perf/collector/benchmarks/webrender");
- cmd!(sh, "cargo update -p url --precise 1.6.1").run()?;
+ let name = match &self.measurement_type {
+ Some(ms) => {
+ let name = ms.as_ref();
+ match ms {
+ MeasurementType::Build => {
+ metrics.measure_build(sh)?;
}
- metrics.measure_analysis_stats(sh, "webrender")?;
- "webrender.json"
- }
- MeasurementType::AnalyzeDiesel => {
- metrics.measure_analysis_stats(sh, "diesel/diesel")?;
- "diesel.json"
- }
- },
+ MeasurementType::AnalyzeSelf => {
+ metrics.measure_analysis_stats_self(sh)?;
+ }
+ MeasurementType::AnalyzeRipgrep
+ | MeasurementType::AnalyzeWebRender
+ | MeasurementType::AnalyzeDiesel
+ | MeasurementType::AnalyzeHyper => {
+ metrics.measure_analysis_stats(sh, name)?;
+ }
+ };
+ name
+ }
None => {
metrics.measure_build(sh)?;
metrics.measure_analysis_stats_self(sh)?;
- metrics.measure_analysis_stats(sh, "ripgrep")?;
- metrics.measure_analysis_stats(sh, "webrender")?;
- metrics.measure_analysis_stats(sh, "diesel/diesel")?;
- "all.json"
+ metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeRipgrep.as_ref())?;
+ metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeWebRender.as_ref())?;
+ metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeDiesel.as_ref())?;
+ metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeHyper.as_ref())?;
+ "all"
}
};
let mut file =
- fs::File::options().write(true).create(true).open(format!("target/{}", filename))?;
+ fs::File::options().write(true).create(true).open(format!("target/{}.json", name))?;
writeln!(file, "{}", metrics.json())?;
eprintln!("{metrics:#?}");
Ok(())
@@ -93,7 +85,7 @@ impl Metrics {
self.measure_analysis_stats_path(
sh,
bench,
- &format!("./target/rustc-perf/collector/benchmarks/{bench}"),
+ &format!("./target/rustc-perf/collector/compile-benchmarks/{bench}"),
)
}
fn measure_analysis_stats_path(
@@ -102,10 +94,9 @@ impl Metrics {
name: &str,
path: &str,
) -> anyhow::Result<()> {
+ assert!(Path::new(path).exists(), "unable to find bench in {path}");
eprintln!("\nMeasuring analysis-stats/{name}");
- let output =
- cmd!(sh, "./target/release/rust-analyzer -q analysis-stats --memory-usage {path}")
- .read()?;
+ let output = cmd!(sh, "./target/release/rust-analyzer -q analysis-stats {path}").read()?;
for (metric, value, unit) in parse_metrics(&output) {
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
}
@@ -147,7 +138,7 @@ impl Metrics {
let host = Host::new(sh)?;
let timestamp = SystemTime::now();
let revision = cmd!(sh, "git rev-parse HEAD").read()?;
- let perf_revision = "c52ee623e231e7690a93be88d943016968c1036b".into();
+ let perf_revision = "a584462e145a0c04760fd9391daefb4f6bd13a99".into();
Ok(Metrics { host, timestamp, revision, perf_revision, metrics: BTreeMap::new() })
}