Skip to content

Commit f21168d

Browse files
committed
Allow benchmarking and profiling stable benchmarks
1 parent 1c32479 commit f21168d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

collector/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ The following options alter the behaviour of the `bench_local` subcommand.
135135
comma-separated list of benchmark prefixes. When this option is specified, a
136136
benchmark is included in the run only if its name matches one of the given
137137
prefixes.
138+
- `--category <CATEGORIES>`: benchmark categories that should be included. The
139+
possible choices are one or more (comma-separated) of `Primary`, `Secondary`,
140+
`Stable`, and `All`. The default is `Primary,Secondary`.
138141
- `--profiles <PROFILES>`: the profiles to be benchmarked. The possible choices
139142
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `Opt`, and
140143
`All`. The default is `Check,Debug,Opt`.

collector/src/bin/collector.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ struct LocalOptions {
322322
/// Include only benchmarks matching a prefix in this comma-separated list
323323
#[arg(long)]
324324
include: Option<String>,
325+
326+
/// Include only benchmarks belonging to the given categories.
327+
#[arg(long, value_parser = EnumArgParser::<Category>::default(), default_value = "Primary,Secondary")]
328+
category: MultiEnumValue<Category>,
325329
}
326330

327331
#[derive(Debug, clap::Args)]
@@ -605,7 +609,7 @@ struct DownloadCommand {
605609
force: bool,
606610

607611
/// What category does the benchmark belong to
608-
#[arg(long, short('c'), value_enum, global = true, default_value = "primary")]
612+
#[arg(long, short('c'), value_enum, global = true, default_value = "Primary")]
609613
category: Category,
610614

611615
/// What artifact type (library or binary) does the benchmark build.
@@ -909,7 +913,7 @@ fn main_result() -> anyhow::Result<i32> {
909913
local.exclude.as_deref(),
910914
local.exclude_suffix.as_deref(),
911915
)?;
912-
benchmarks.retain(|b| b.category().is_primary_or_secondary());
916+
benchmarks.retain(|b| local.category.0.contains(&b.category()));
913917

914918
let artifact_id = ArtifactId::Tag(toolchain.id.clone());
915919
let mut conn = rt.block_on(pool.connection());
@@ -1082,7 +1086,7 @@ fn main_result() -> anyhow::Result<i32> {
10821086
local.exclude.as_deref(),
10831087
local.exclude_suffix.as_deref(),
10841088
)?;
1085-
benchmarks.retain(|b| b.category().is_primary_or_secondary());
1089+
benchmarks.retain(|b| local.category.0.contains(&b.category()));
10861090

10871091
let mut errors = BenchmarkErrors::new();
10881092

collector/src/compile/benchmark/category.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::fmt;
33

44
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, clap::ValueEnum)]
55
#[serde(rename_all = "kebab-case")]
6+
#[value(rename_all = "PascalCase")]
67
pub enum Category {
78
Primary,
89
Secondary,

0 commit comments

Comments
 (0)