Skip to content

Commit 3de0564

Browse files
committed
Add summary table at top of triage
1 parent 8f35244 commit 3de0564

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,
@@ -765,7 +778,7 @@ impl ArtifactComparison {
765778
/// Splits an artifact comparison into primary and secondary summaries based on benchmark category
766779
pub fn summarize_by_category(
767780
self,
768-
category_map: HashMap<Benchmark, Category>,
781+
category_map: &HashMap<Benchmark, Category>,
769782
) -> (ArtifactComparisonSummary, ArtifactComparisonSummary) {
770783
let (primary, secondary) = self
771784
.comparisons
@@ -1112,6 +1125,7 @@ impl Magnitude {
11121125
async fn generate_report(
11131126
start: &Bound,
11141127
end: &Bound,
1128+
summary: String,
11151129
mut report: HashMap<Direction, Vec<String>>,
11161130
num_comparisons: usize,
11171131
) -> String {
@@ -1151,6 +1165,8 @@ TODO: Summary
11511165
Triage done by **@???**.
11521166
Revision range: [{first_commit}..{last_commit}](https://perf.rust-lang.org/?start={first_commit}&end={last_commit}&absolute=false&stat=instructions%3Au)
11531167
1168+
{summary}
1169+
11541170
{num_regressions} Regressions, {num_improvements} Improvements, {num_mixed} Mixed; ??? of them in rollups
11551171
{num_comparisons} artifact comparisons made in total
11561172

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)