Skip to content

Commit 6b2e205

Browse files
authored
Merge pull request #1441 from rust-lang/excluded-profiles
Add the option to ignore certain profiles in `perf-config.json`
2 parents e78840c + 33c349a commit 6b2e205

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

collector/src/benchmark/mod.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::execute::{CargoProcess, Processor};
66
use crate::toolchain::Compiler;
77
use anyhow::{bail, Context};
88
use log::debug;
9-
use std::collections::HashMap;
9+
use std::collections::{HashMap, HashSet};
1010
use std::fs::File;
1111
use std::mem::ManuallyDrop;
1212
use std::path::{Path, PathBuf};
@@ -41,6 +41,10 @@ struct BenchmarkConfig {
4141
touch_file: Option<String>,
4242

4343
category: Category,
44+
/// Profiles that are not useful for this benchmark.
45+
/// They will be ignored during benchmarking.
46+
#[serde(default)]
47+
excluded_profiles: HashSet<Profile>,
4448
}
4549

4650
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone, Hash)]
@@ -183,11 +187,22 @@ impl Benchmark {
183187
) -> anyhow::Result<()> {
184188
let iterations = iterations.unwrap_or(self.config.runs);
185189

186-
if self.config.disabled || profiles.is_empty() {
190+
let profiles: Vec<Profile> = profiles
191+
.into_iter()
192+
.copied()
193+
.filter(|profile| !self.config.excluded_profiles.contains(profile))
194+
.collect();
195+
196+
if self.config.disabled {
187197
eprintln!("Skipping {}: disabled", self.name);
188198
bail!("disabled benchmark");
189199
}
190200

201+
if profiles.is_empty() {
202+
eprintln!("Skipping {}: no profiles selected", self.name);
203+
return Ok(());
204+
}
205+
191206
eprintln!("Preparing {}", self.name);
192207
let profile_dirs = profiles
193208
.iter()

collector/src/benchmark/profile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, clap::ArgEnum)]
1+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, clap::ArgEnum, serde::Deserialize)]
22
#[clap(rename_all = "PascalCase")]
33
pub enum Profile {
44
Check,

0 commit comments

Comments
 (0)