Skip to content
Open
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
2 changes: 1 addition & 1 deletion database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl Profile {

/// Set of default profiles that should be benchmarked for a master/try artifact.
pub fn default_profiles() -> Vec<Self> {
vec![Profile::Check, Profile::Debug, Profile::Doc, Profile::Opt]
vec![Profile::Check, Profile::Debug, Profile::Opt, Profile::Doc]
}

pub fn all_values() -> &'static [Self] {
Expand Down
5 changes: 5 additions & 0 deletions database/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ impl CompileBenchmarkQuery {
self
}

pub fn target(mut self, selector: Selector<Target>) -> Self {
self.target = selector;
self
}

pub fn metric(mut self, selector: Selector<Metric>) -> Self {
self.metric = selector.map(|v| v.as_str().into());
self
Expand Down
26 changes: 14 additions & 12 deletions site/src/request_handlers/graph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::str::FromStr;
use std::sync::Arc;

use collector::Bound;
Expand All @@ -13,7 +14,7 @@ use database::interpolate::IsInterpolated;
use database::selector::{
CompileBenchmarkQuery, CompileTestCase, RuntimeBenchmarkQuery, Selector, SeriesResponse,
};
use database::{self, ArtifactId, Profile, Scenario};
use database::{self, ArtifactId, CodegenBackend, Profile, Scenario, Target};

/// Returns data for before/after graphs when comparing a single test result comparison
/// for a compile-time benchmark.
Expand Down Expand Up @@ -209,24 +210,28 @@ async fn create_graphs(
));
let mut benchmarks = HashMap::new();

let create_selector = |filter: &Option<String>| -> Selector<String> {
fn create_selector<T: FromStr>(filter: &Option<String>) -> Option<Result<Selector<T>, T::Err>> {
filter
.as_ref()
.map(|value| Selector::One(value.clone()))
.unwrap_or(Selector::All)
};
.map(|s| s.try_map(|v| v.parse::<T>()))
}

let benchmark_selector = create_selector(&request.benchmark);
let profile_selector = create_selector(&request.profile).try_map(|v| v.parse::<Profile>())?;
let scenario_selector =
create_selector(&request.scenario).try_map(|v| v.parse::<Scenario>())?;
let benchmark_selector = create_selector(&request.benchmark)
.unwrap_or(Ok(Selector::All))
.unwrap();
let profile_selector = create_selector(&request.profile)
.unwrap_or_else(|| Ok(Selector::Subset(Profile::default_profiles())))?;
let scenario_selector = create_selector(&request.scenario).unwrap_or(Ok(Selector::All))?;

let interpolated_responses: Vec<_> = ctxt
.statistic_series(
CompileBenchmarkQuery::default()
.benchmark(benchmark_selector)
.profile(profile_selector)
.scenario(scenario_selector)
.backend(Selector::One(CodegenBackend::Llvm))
.target(Selector::One(Target::X86_64UnknownLinuxGnu))
.metric(Selector::One(request.stat.parse()?)),
artifact_ids.clone(),
)
Expand Down Expand Up @@ -302,10 +307,7 @@ fn create_summary(
let mut summary_benchmark = HashMap::new();
let summary_query_cases = iproduct!(
ctxt.summary_scenarios(),
profile.map_or_else(
|| vec![Profile::Check, Profile::Debug, Profile::Opt, Profile::Doc],
|p| vec![p]
)
profile.map_or_else(Profile::default_profiles, |p| vec![p])
);
for (scenario, profile) in summary_query_cases {
let baseline = match baselines.entry((profile, scenario)) {
Expand Down
Loading