Skip to content

Commit 9b20563

Browse files
authored
Merge pull request #1787 from Kobzol/triage-metric
Allow creating triage report for arbitrary metric
2 parents 1428985 + 7797837 commit 9b20563

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

site/src/api.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ pub mod github {
569569
}
570570

571571
pub mod triage {
572+
use crate::comparison::Metric;
572573
use collector::Bound;
573574
use serde::{Deserialize, Serialize};
574575

@@ -577,6 +578,8 @@ pub mod triage {
577578
pub start: Bound,
578579
#[serde(default)]
579580
pub end: Bound,
581+
#[serde(default)]
582+
pub metric: Option<Metric>,
580583
}
581584

582585
#[derive(Debug, Clone, Serialize, Deserialize)]

site/src/comparison.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub async fn handle_triage(
5959
let mut before = start.clone();
6060

6161
let mut num_comparisons = 0;
62-
let metric = Metric::InstructionsUser;
62+
let metric = body.metric.unwrap_or(Metric::InstructionsUser);
6363
let benchmark_map = ctxt.get_benchmark_category_map().await;
6464

6565
let end = loop {
@@ -85,7 +85,7 @@ pub async fn handle_triage(
8585
);
8686

8787
// handle results of comparison
88-
populate_report(&comparison, &benchmark_map, &mut report).await;
88+
populate_report(&comparison, &benchmark_map, metric, &mut report).await;
8989

9090
// If we already know this is the last iteration, we can stop
9191
if comparison.b.artifact == end_artifact {
@@ -207,6 +207,7 @@ pub async fn handle_compare(
207207
async fn populate_report(
208208
comparison: &ArtifactComparison,
209209
benchmark_map: &HashMap<Benchmark, Category>,
210+
metric: Metric,
210211
report: &mut HashMap<Direction, Vec<String>>,
211212
) {
212213
let (primary, secondary) = comparison
@@ -218,7 +219,14 @@ async fn populate_report(
218219
return;
219220
}
220221

221-
let include_in_triage = deserves_attention_icount(&primary, &secondary);
222+
let include_in_triage = match metric {
223+
Metric::InstructionsUser => deserves_attention_icount(&primary, &secondary),
224+
_ => primary
225+
.largest_change()
226+
.or_else(|| secondary.largest_change())
227+
.map(|c| c.magnitude() >= Magnitude::Small)
228+
.unwrap_or(false),
229+
};
222230

223231
if include_in_triage {
224232
let entry = report.entry(direction).or_default();

triage/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Use the API endpoint to automate building the file:
3030
% curl "https://perf.rust-lang.org/perf/triage?start=$PARENT" > YYYY-MM-DD.md
3131
```
3232

33+
You can also analyze binary size regressions/improvements using the following command:
34+
```
35+
% curl "https://perf.rust-lang.org/perf/triage?start=$PARENT&metric=size:linked-artifact" > binary-size.md
36+
```
37+
3338
## Analysis
3439

3540
The following is a list of items you should look for when interpreting performance results.

0 commit comments

Comments
 (0)