Skip to content

Commit 3fd967e

Browse files
authored
Merge pull request #1316 from rylev/summarize-triage
Add summary table at top of triage
2 parents 203ac1a + 3de0564 commit 3fd967e

File tree

2 files changed

+42
-26
lines changed

2 files changed

+42
-26
lines changed

site/src/comparison.rs

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,23 @@ pub async fn handle_triage(
4444
let mut before = start.clone();
4545

4646
let mut num_comparisons = 0;
47+
let stat = "instructions:u".to_owned();
48+
let benchmark_map = ctxt.get_benchmark_category_map().await;
4749
loop {
48-
let comparison = match compare_given_commits(
49-
before,
50-
next.clone(),
51-
"instructions:u".to_owned(),
52-
ctxt,
53-
&master_commits,
54-
)
55-
.await
56-
.map_err(|e| format!("error comparing commits: {}", e))?
57-
{
58-
Some(c) => c,
59-
None => {
60-
log::info!(
61-
"No data found for end bound {:?}. Ending comparison...",
62-
next
63-
);
64-
break;
65-
}
66-
};
50+
let comparison =
51+
match compare_given_commits(before, next.clone(), stat.clone(), ctxt, &master_commits)
52+
.await
53+
.map_err(|e| format!("error comparing commits: {}", e))?
54+
{
55+
Some(c) => c,
56+
None => {
57+
log::info!(
58+
"No data found for end bound {:?}. Ending comparison...",
59+
next
60+
);
61+
break;
62+
}
63+
};
6764
num_comparisons += 1;
6865
log::info!(
6966
"Comparing {} to {}",
@@ -72,7 +69,7 @@ pub async fn handle_triage(
7269
);
7370

7471
// handle results of comparison
75-
populate_report(ctxt, &comparison, &mut report).await;
72+
populate_report(&comparison, &benchmark_map, &mut report).await;
7673

7774
// Check that there is a next commit and that the
7875
// after commit is not equal to `end`
@@ -86,7 +83,24 @@ pub async fn handle_triage(
8683
}
8784
let end = end.unwrap_or(next);
8885

89-
let report = generate_report(&start, &end, report, num_comparisons).await;
86+
// Summarize the entire triage from start commit to end commit
87+
let summary =
88+
match compare_given_commits(start.clone(), end.clone(), stat, ctxt, master_commits)
89+
.await
90+
.map_err(|e| format!("error comparing beginning and ending commits: {}", e))?
91+
{
92+
Some(summary_comparison) => {
93+
let (primary, secondary) = summary_comparison
94+
.clone()
95+
.summarize_by_category(&benchmark_map);
96+
let mut result = String::from("**Summary**:\n");
97+
write_summary_table(&primary, &secondary, false, &mut result);
98+
result
99+
}
100+
None => String::from("**ERROR**: no data found for end bound"),
101+
};
102+
103+
let report = generate_report(&start, &end, summary, report, num_comparisons).await;
90104
Ok(api::triage::Response(report))
91105
}
92106

@@ -144,12 +158,11 @@ pub async fn handle_compare(
144158
}
145159

146160
async fn populate_report(
147-
ctxt: &SiteCtxt,
148161
comparison: &ArtifactComparison,
162+
benchmark_map: &HashMap<Benchmark, Category>,
149163
report: &mut HashMap<Direction, Vec<String>>,
150164
) {
151-
let benchmark_map = ctxt.get_benchmark_category_map().await;
152-
let (primary, secondary) = comparison.clone().summarize_by_category(benchmark_map);
165+
let (primary, secondary) = comparison.clone().summarize_by_category(&benchmark_map);
153166
// Get the combined direction of the primary and secondary summaries
154167
let direction = match (primary.direction(), secondary.direction()) {
155168
(Some(d1), Some(d2)) if d1 != d2 => Direction::Mixed,
@@ -794,7 +807,7 @@ impl ArtifactComparison {
794807
/// Splits an artifact comparison into primary and secondary summaries based on benchmark category
795808
pub fn summarize_by_category(
796809
self,
797-
category_map: HashMap<Benchmark, Category>,
810+
category_map: &HashMap<Benchmark, Category>,
798811
) -> (ArtifactComparisonSummary, ArtifactComparisonSummary) {
799812
let (primary, secondary) = self
800813
.comparisons
@@ -1141,6 +1154,7 @@ impl Magnitude {
11411154
async fn generate_report(
11421155
start: &Bound,
11431156
end: &Bound,
1157+
summary: String,
11441158
mut report: HashMap<Direction, Vec<String>>,
11451159
num_comparisons: usize,
11461160
) -> String {
@@ -1180,6 +1194,8 @@ TODO: Summary
11801194
Triage done by **@???**.
11811195
Revision range: [{first_commit}..{last_commit}](https://perf.rust-lang.org/?start={first_commit}&end={last_commit}&absolute=false&stat=instructions%3Au)
11821196
1197+
{summary}
1198+
11831199
{num_regressions} Regressions, {num_improvements} Improvements, {num_mixed} Mixed; ??? of them in rollups
11841200
{num_comparisons} artifact comparisons made in total
11851201

site/src/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ async fn summarize_run(ctxt: &SiteCtxt, commit: QueuedCommit, is_master_commit:
596596
};
597597

598598
let benchmark_map = ctxt.get_benchmark_category_map().await;
599-
let (primary, secondary) = comparison.summarize_by_category(benchmark_map);
599+
let (primary, secondary) = comparison.summarize_by_category(&benchmark_map);
600600

601601
const DISAGREEMENT: &str = "If you disagree with this performance assessment, \
602602
please file an issue in [rust-lang/rustc-perf](https://github.com/rust-lang/rustc-perf/issues/new).";

0 commit comments

Comments
 (0)