diff --git a/src/plot.rs b/src/plot.rs index c8bb879..276dc2f 100644 --- a/src/plot.rs +++ b/src/plot.rs @@ -100,7 +100,7 @@ impl BenchEntry { } } -fn plot_for_data(bench_group: &BenchGroup) -> Result<(), Box> { +fn plot_for_data(ext_title: Option<&str>, bench_group: &BenchGroup) -> Result<(), Box> { let min = bench_group .results .iter() @@ -125,6 +125,10 @@ fn plot_for_data(bench_group: &BenchGroup) -> Result<(), Box> { let category = bench_group.category; let name = &bench_group.name; let test_id = format!("{category}/{name}"); + let test_title = match ext_title { + Some(ext_title) => format!("{test_id} - {ext_title}"), + None => test_id, + }; let path = format!("target/wasmi-benchmarks/{category}/{name}.svg"); let _ = std::fs::create_dir_all(&path); let _ = std::fs::remove_dir(&path); @@ -132,8 +136,8 @@ fn plot_for_data(bench_group: &BenchGroup) -> Result<(), Box> { let root = SVGBackend::new(&path, (1280, height)).into_drawing_area(); root.fill(&color::WHITE)?; let root = root.margin(5, 5, 5, 5).titled( - &test_id, - TextStyle::from(("monospace", 50)).pos(Pos::new(HPos::Center, VPos::Center)), + &test_title, + TextStyle::from(("monospace", 45)).pos(Pos::new(HPos::Center, VPos::Center)), )?; let mut chart = ChartBuilder::on(&root) .x_label_area_size(75) @@ -267,6 +271,9 @@ fn decode_stdin() -> Result<(), Box> { use serde_json as json; use std::io::{self, BufRead}; + let args: Vec = std::env::args().collect(); + let ext_title = args.get(1).cloned(); + // Create a buffer to read input let stdin = io::stdin(); let handle = stdin.lock(); @@ -338,7 +345,7 @@ fn decode_stdin() -> Result<(), Box> { // reason: group-complete // - group_name: "{exec-or-compile} / {test-case}" if let Some(bench_group) = bench_group.take() { - plot_for_data(&bench_group)?; + plot_for_data(ext_title.as_deref(), &bench_group)?; } } _ => panic!("malformed JSON input: {json:?}"),