about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-02-04 11:14:00 +0100
committerJakub Beránek <berykubik@gmail.com>2025-02-05 15:33:40 +0100
commitc73ed895c700bd646af5bfbd111268fcaca9fda0 (patch)
treec5857218f93232eef6ffbc49398cac004e1e0f04
parent22e44919c5812f0f68640bcca4bacb441a6deaed (diff)
downloadrust-c73ed895c700bd646af5bfbd111268fcaca9fda0.tar.gz
rust-c73ed895c700bd646af5bfbd111268fcaca9fda0.zip
Remove the `rustc-perf-wrapper` tool
-rw-r--r--Cargo.lock7
-rw-r--r--Cargo.toml1
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs1
-rw-r--r--src/tools/rustc-perf-wrapper/Cargo.toml7
-rw-r--r--src/tools/rustc-perf-wrapper/README.md3
-rw-r--r--src/tools/rustc-perf-wrapper/src/config.rs45
-rw-r--r--src/tools/rustc-perf-wrapper/src/main.rs178
-rw-r--r--triagebot.toml1
8 files changed, 0 insertions, 243 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7c8f06a0239..ba7090baa67 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3288,13 +3288,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "rustc-perf-wrapper"
-version = "0.1.0"
-dependencies = [
- "clap",
-]
-
-[[package]]
 name = "rustc-rayon"
 version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 68d142ebe92..97e782d0df0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,7 +45,6 @@ members = [
   "src/tools/rustdoc-gui-test",
   "src/tools/opt-dist",
   "src/tools/coverage-dump",
-  "src/tools/rustc-perf-wrapper",
   "src/tools/wasm-component-ld",
   "src/tools/features-status-dump",
 ]
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 75fac88252b..734ade8bfed 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -362,7 +362,6 @@ bootstrap_tool!(
     GenerateWindowsSys, "src/tools/generate-windows-sys", "generate-windows-sys";
     RustdocGUITest, "src/tools/rustdoc-gui-test", "rustdoc-gui-test", is_unstable_tool = true, allow_features = "test";
     CoverageDump, "src/tools/coverage-dump", "coverage-dump";
-    RustcPerfWrapper, "src/tools/rustc-perf-wrapper", "rustc-perf-wrapper";
     WasmComponentLd, "src/tools/wasm-component-ld", "wasm-component-ld", is_unstable_tool = true, allow_features = "min_specialization";
     UnicodeTableGenerator, "src/tools/unicode-table-generator", "unicode-table-generator";
     FeaturesStatusDump, "src/tools/features-status-dump", "features-status-dump";
diff --git a/src/tools/rustc-perf-wrapper/Cargo.toml b/src/tools/rustc-perf-wrapper/Cargo.toml
deleted file mode 100644
index 416bfef41d7..00000000000
--- a/src/tools/rustc-perf-wrapper/Cargo.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-[package]
-name = "rustc-perf-wrapper"
-version = "0.1.0"
-edition = "2021"
-
-[dependencies]
-clap = { version = "4.5.7", features = ["derive", "env"] }
diff --git a/src/tools/rustc-perf-wrapper/README.md b/src/tools/rustc-perf-wrapper/README.md
deleted file mode 100644
index d7655459a2f..00000000000
--- a/src/tools/rustc-perf-wrapper/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# rustc-perf wrapper
-Utility tool for invoking [`rustc-perf`](https://github.com/rust-lang/rustc-perf) for benchmarking/profiling
-a stage1/2 compiler built by bootstrap using `x perf -- <command>`.
diff --git a/src/tools/rustc-perf-wrapper/src/config.rs b/src/tools/rustc-perf-wrapper/src/config.rs
deleted file mode 100644
index a88abfe4723..00000000000
--- a/src/tools/rustc-perf-wrapper/src/config.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-use std::fmt::{Display, Formatter};
-
-#[derive(Clone, Copy, Debug, clap::ValueEnum)]
-#[value(rename_all = "PascalCase")]
-pub enum Profile {
-    Check,
-    Debug,
-    Doc,
-    Opt,
-    Clippy,
-}
-
-impl Display for Profile {
-    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
-        let name = match self {
-            Profile::Check => "Check",
-            Profile::Debug => "Debug",
-            Profile::Doc => "Doc",
-            Profile::Opt => "Opt",
-            Profile::Clippy => "Clippy",
-        };
-        f.write_str(name)
-    }
-}
-
-#[derive(Clone, Copy, Debug, clap::ValueEnum)]
-#[value(rename_all = "PascalCase")]
-pub enum Scenario {
-    Full,
-    IncrFull,
-    IncrUnchanged,
-    IncrPatched,
-}
-
-impl Display for Scenario {
-    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
-        let name = match self {
-            Scenario::Full => "Full",
-            Scenario::IncrFull => "IncrFull",
-            Scenario::IncrUnchanged => "IncrUnchanged",
-            Scenario::IncrPatched => "IncrPatched",
-        };
-        f.write_str(name)
-    }
-}
diff --git a/src/tools/rustc-perf-wrapper/src/main.rs b/src/tools/rustc-perf-wrapper/src/main.rs
deleted file mode 100644
index e6c885e23de..00000000000
--- a/src/tools/rustc-perf-wrapper/src/main.rs
+++ /dev/null
@@ -1,178 +0,0 @@
-use std::fs::create_dir_all;
-use std::path::{Path, PathBuf};
-use std::process::Command;
-
-use clap::Parser;
-
-use crate::config::{Profile, Scenario};
-
-mod config;
-
-/// Performs profiling or benchmarking with [`rustc-perf`](https://github.com/rust-lang/rustc-perf)
-/// using a locally built compiler.
-#[derive(Debug, clap::Parser)]
-// Hide arguments from BuildContext in the default usage string.
-// Clap does not seem to have a way of disabling the usage of these arguments.
-#[clap(override_usage = "rustc-perf-wrapper [OPTIONS] <COMMAND>")]
-pub struct Args {
-    #[clap(subcommand)]
-    cmd: PerfCommand,
-
-    #[clap(flatten)]
-    ctx: BuildContext,
-}
-
-#[derive(Debug, clap::Parser)]
-enum PerfCommand {
-    /// Run `profile_local eprintln`.
-    /// This executes the compiler on the given benchmarks and stores its stderr output.
-    Eprintln {
-        #[clap(flatten)]
-        opts: SharedOpts,
-    },
-    /// Run `profile_local samply`
-    /// This executes the compiler on the given benchmarks and profiles it with `samply`.
-    /// You need to install `samply`, e.g. using `cargo install samply`.
-    Samply {
-        #[clap(flatten)]
-        opts: SharedOpts,
-    },
-    /// Run `profile_local cachegrind`.
-    /// This executes the compiler on the given benchmarks under `Cachegrind`.
-    Cachegrind {
-        #[clap(flatten)]
-        opts: SharedOpts,
-    },
-    Benchmark {
-        /// Identifier to associate benchmark results with
-        id: String,
-
-        #[clap(flatten)]
-        opts: SharedOpts,
-    },
-    Compare {
-        /// The name of the base artifact to be compared.
-        base: String,
-
-        /// The name of the modified artifact to be compared.
-        modified: String,
-    },
-}
-
-#[derive(Debug, clap::Parser)]
-struct SharedOpts {
-    /// Select the benchmarks that you want to run (separated by commas).
-    /// If unspecified, all benchmarks will be executed.
-    #[clap(long, global = true, value_delimiter = ',')]
-    include: Vec<String>,
-
-    /// Select the benchmarks matching a prefix in this comma-separated list that you don't want to run.
-    #[clap(long, global = true, value_delimiter = ',')]
-    exclude: Vec<String>,
-
-    /// Select the scenarios that should be benchmarked.
-    #[clap(
-        long,
-        global = true,
-        value_delimiter = ',',
-        default_value = "Full,IncrFull,IncrUnchanged,IncrPatched"
-    )]
-    scenarios: Vec<Scenario>,
-    /// Select the profiles that should be benchmarked.
-    #[clap(long, global = true, value_delimiter = ',', default_value = "Check,Debug,Opt")]
-    profiles: Vec<Profile>,
-}
-
-/// These arguments are mostly designed to be passed from bootstrap, not by users
-/// directly.
-#[derive(Debug, clap::Parser)]
-struct BuildContext {
-    /// Compiler binary that will be benchmarked/profiled.
-    #[clap(long, hide = true, env = "RUSTC_REAL")]
-    compiler: PathBuf,
-    /// rustc-perf collector binary that will be used for running benchmarks/profilers.
-    #[clap(long, hide = true, env = "PERF_COLLECTOR")]
-    collector: PathBuf,
-    /// Directory where to store results.
-    #[clap(long, hide = true, env = "PERF_RESULT_DIR")]
-    results_dir: PathBuf,
-}
-
-fn main() {
-    let args = Args::parse();
-    run(args);
-}
-
-fn run(args: Args) {
-    let mut cmd = Command::new(args.ctx.collector);
-    let db_path = args.ctx.results_dir.join("results.db");
-
-    match &args.cmd {
-        PerfCommand::Eprintln { opts }
-        | PerfCommand::Samply { opts }
-        | PerfCommand::Cachegrind { opts } => {
-            cmd.arg("profile_local");
-            cmd.arg(match &args.cmd {
-                PerfCommand::Eprintln { .. } => "eprintln",
-                PerfCommand::Samply { .. } => "samply",
-                PerfCommand::Cachegrind { .. } => "cachegrind",
-                _ => unreachable!(),
-            });
-
-            cmd.arg("--out-dir").arg(&args.ctx.results_dir);
-
-            apply_shared_opts(&mut cmd, opts);
-            execute_benchmark(&mut cmd, &args.ctx.compiler);
-
-            println!("You can find the results at `{}`", args.ctx.results_dir.display());
-        }
-        PerfCommand::Benchmark { id, opts } => {
-            cmd.arg("bench_local");
-            cmd.arg("--db").arg(&db_path);
-            cmd.arg("--id").arg(id);
-
-            apply_shared_opts(&mut cmd, opts);
-            create_dir_all(&args.ctx.results_dir).unwrap();
-            execute_benchmark(&mut cmd, &args.ctx.compiler);
-        }
-        PerfCommand::Compare { base, modified } => {
-            cmd.arg("bench_cmp");
-            cmd.arg("--db").arg(&db_path);
-            cmd.arg(base).arg(modified);
-
-            create_dir_all(&args.ctx.results_dir).unwrap();
-            cmd.status().expect("error while running rustc-perf bench_cmp");
-        }
-    }
-}
-
-fn apply_shared_opts(cmd: &mut Command, opts: &SharedOpts) {
-    if !opts.include.is_empty() {
-        cmd.arg("--include").arg(opts.include.join(","));
-    }
-    if !opts.exclude.is_empty() {
-        cmd.arg("--exclude").arg(opts.exclude.join(","));
-    }
-    if !opts.profiles.is_empty() {
-        cmd.arg("--profiles")
-            .arg(opts.profiles.iter().map(|p| p.to_string()).collect::<Vec<_>>().join(","));
-    }
-    if !opts.scenarios.is_empty() {
-        cmd.arg("--scenarios")
-            .arg(opts.scenarios.iter().map(|p| p.to_string()).collect::<Vec<_>>().join(","));
-    }
-}
-
-fn execute_benchmark(cmd: &mut Command, compiler: &Path) {
-    cmd.arg(compiler);
-    println!("Running `rustc-perf` using `{}`", compiler.display());
-
-    const MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");
-
-    let rustc_perf_dir = Path::new(MANIFEST_DIR).join("../rustc-perf");
-
-    // We need to set the working directory to `src/tools/perf`, so that it can find the directory
-    // with compile-time benchmarks.
-    let cmd = cmd.current_dir(rustc_perf_dir);
-    cmd.status().expect("error while running rustc-perf collector");
-}
diff --git a/triagebot.toml b/triagebot.toml
index 49cf1213987..61f85e84dc7 100644
--- a/triagebot.toml
+++ b/triagebot.toml
@@ -385,7 +385,6 @@ trigger_files = [
     "src/tools/tidy",
     "src/tools/rustdoc-gui-test",
     "src/tools/libcxx-version",
-    "src/tools/rustc-perf-wrapper",
     "x.py",
     "x",
     "x.ps1"