Skip to content

Allow benchmarking and profiling stable benchmarks #1780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ The following options alter the behaviour of the `bench_local` subcommand.
comma-separated list of benchmark prefixes. When this option is specified, a
benchmark is included in the run only if its name matches one of the given
prefixes.
- `--category <CATEGORIES>`: benchmark categories that should be included. The
possible choices are one or more (comma-separated) of `Primary`, `Secondary`,
`Stable`, and `All`. The default is `Primary,Secondary`.
- `--profiles <PROFILES>`: the profiles to be benchmarked. The possible choices
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `Opt`, and
`All`. The default is `Check,Debug,Opt`.
Expand Down
10 changes: 7 additions & 3 deletions collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ struct LocalOptions {
/// Include only benchmarks matching a prefix in this comma-separated list
#[arg(long)]
include: Option<String>,

/// Include only benchmarks belonging to the given categories.
#[arg(long, value_parser = EnumArgParser::<Category>::default(), default_value = "Primary,Secondary")]
category: MultiEnumValue<Category>,
}

#[derive(Debug, clap::Args)]
Expand Down Expand Up @@ -605,7 +609,7 @@ struct DownloadCommand {
force: bool,

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

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

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

let mut errors = BenchmarkErrors::new();

Expand Down
1 change: 1 addition & 0 deletions collector/src/compile/benchmark/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt;

#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, clap::ValueEnum)]
#[serde(rename_all = "kebab-case")]
#[value(rename_all = "PascalCase")]
pub enum Category {
Primary,
Secondary,
Expand Down