Run metadata on sysroot for CI metrics

This commit is contained in:
Lukas Wirth 2024-01-17 09:43:04 +01:00
parent 7777a81b69
commit 21723cb051
3 changed files with 10 additions and 1 deletions

View File

@ -63,6 +63,7 @@ impl flags::AnalysisStats {
true => None,
false => Some(RustLibSource::Discover),
};
cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
let no_progress = &|_| ();
let mut db_load_sw = self.stop_watch();

View File

@ -71,6 +71,9 @@ xflags::xflags! {
optional --with-deps
/// Don't load sysroot crates (`std`, `core` & friends).
optional --no-sysroot
/// Run cargo metadata on the sysroot to analyze its third-pary dependencies.
/// Requires --no-sysroot to not be set.
optional --query-sysroot-metadata
/// Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.
optional --disable-build-scripts
@ -206,6 +209,7 @@ pub struct AnalysisStats {
pub only: Option<String>,
pub with_deps: bool,
pub no_sysroot: bool,
pub query_sysroot_metadata: bool,
pub disable_build_scripts: bool,
pub disable_proc_macros: bool,
pub skip_lowering: bool,

View File

@ -113,7 +113,11 @@ impl Metrics {
) -> 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 {path}").read()?;
let output = cmd!(
sh,
"./target/release/rust-analyzer -q analysis-stats {path} --query-sysroot-metadata"
)
.read()?;
for (metric, value, unit) in parse_metrics(&output) {
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
}