mirror of
https://github.com/ktims/rs-aggregate.git
synced 2025-01-18 09:12:51 -08:00
Improve bench graph outputs
This commit is contained in:
parent
caf0bbdbe3
commit
ceaf503407
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -391,9 +391,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.6"
|
version = "0.3.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
|
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
|
@ -6,6 +6,7 @@ use plotters::drawing::IntoDrawingArea;
|
|||||||
use plotters::element::{Circle, EmptyElement, Text};
|
use plotters::element::{Circle, EmptyElement, Text};
|
||||||
use plotters::series::{Histogram, PointSeries};
|
use plotters::series::{Histogram, PointSeries};
|
||||||
use plotters::style::full_palette::{BLUEGREY, GREY};
|
use plotters::style::full_palette::{BLUEGREY, GREY};
|
||||||
|
use plotters::style::text_anchor::{HPos, Pos, VPos};
|
||||||
use plotters::style::{Color, IntoFont, RGBAColor, RGBColor, ShapeStyle, BLACK, WHITE};
|
use plotters::style::{Color, IntoFont, RGBAColor, RGBColor, ShapeStyle, BLACK, WHITE};
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
@ -74,8 +75,7 @@ fn make_tests(input_path: &str) -> Vec<TestDefinition> {
|
|||||||
name: our_version.into(),
|
name: our_version.into(),
|
||||||
},
|
},
|
||||||
TestDefinition {
|
TestDefinition {
|
||||||
cmd: format!("aggregate6 {}", input_path),
|
cmd: format!("python3 -m aggregate6 {}", input_path),
|
||||||
// cmd: "sleep 0.25".into(),
|
|
||||||
name: format!("{} ({})", agg6_version.trim(), python_version.trim()),
|
name: format!("{} ({})", agg6_version.trim(), python_version.trim()),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -112,13 +112,13 @@ where
|
|||||||
.arg("--export-json")
|
.arg("--export-json")
|
||||||
.arg(resultfile.path())
|
.arg(resultfile.path())
|
||||||
.arg("--min-runs")
|
.arg("--min-runs")
|
||||||
.arg("2")
|
.arg("10")
|
||||||
.arg("--")
|
.arg("--")
|
||||||
.arg(cmd)
|
.arg(&cmd)
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("unable to run command");
|
.expect("unable to run command");
|
||||||
let rc = process.wait().expect("unable to wait on process");
|
let _rc = process.wait().expect("unable to wait on process");
|
||||||
|
|
||||||
let mut raw_result_buf = Vec::new();
|
let mut raw_result_buf = Vec::new();
|
||||||
resultfile
|
resultfile
|
||||||
@ -127,8 +127,13 @@ where
|
|||||||
.expect("Can't read results");
|
.expect("Can't read results");
|
||||||
resultfile.close().unwrap();
|
resultfile.close().unwrap();
|
||||||
|
|
||||||
let hf_result = json::parse(&String::from_utf8_lossy(&raw_result_buf))
|
let hf_result = json::parse(&String::from_utf8_lossy(&raw_result_buf)).expect(
|
||||||
.expect("Can't parse hyperfine json results");
|
format!(
|
||||||
|
"Can't parse hyperfine json results from command `{}`",
|
||||||
|
cmd.as_ref().to_string_lossy()
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
let final_result = &hf_result["results"][0];
|
let final_result = &hf_result["results"][0];
|
||||||
|
|
||||||
@ -188,11 +193,19 @@ fn plot_results(
|
|||||||
5,
|
5,
|
||||||
ShapeStyle::from(&BLACK).filled(),
|
ShapeStyle::from(&BLACK).filled(),
|
||||||
&|coord, size, style| {
|
&|coord, size, style| {
|
||||||
|
let (target_y, target_colour) = if coord.1 < 25.0 {
|
||||||
|
(-25, BAR_COLOUR)
|
||||||
|
} else {
|
||||||
|
(25, WHITE)
|
||||||
|
};
|
||||||
EmptyElement::at(coord.clone())
|
EmptyElement::at(coord.clone())
|
||||||
+ Text::new(
|
+ Text::new(
|
||||||
format!("{:.1} x", coord.1),
|
format!("{:.1} x", coord.1),
|
||||||
(0, 10),
|
(0, target_y),
|
||||||
("Roboto", 18).into_font().color(&WHITE),
|
("Roboto", 18)
|
||||||
|
.into_font()
|
||||||
|
.color(&target_colour)
|
||||||
|
.pos(Pos::new(HPos::Center, VPos::Center)),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
))?;
|
))?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user