Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
34815ac
add a bunch of assertions that measurements are not zero, trying to t…
May 25, 2025
a867eeb
fix "zero-time measurements" bug
May 25, 2025
16926d8
add a couple of more asserts that measurements aren't 0 (or epsilon)
May 25, 2025
ae543cd
add another fix for measurements being 0 in a different place
May 25, 2025
1a0113e
add docstring
May 25, 2025
56edb08
interim commit (doesn't compile!)
May 27, 2025
8cef4c2
use the new "{varname}" format instead of "{}, varname" to make clippy
May 27, 2025
7fc5cce
Cargo.lock
May 28, 2025
fd8f7b0
inline a bunch more formatted variables
May 28, 2025
8c02527
bring the RDPTSCP measurement over from smalloc
May 28, 2025
cecd263
remove debug printout
May 28, 2025
a7e7359
fix MachAbsoluteTimer
May 28, 2025
a3065a3
fix clippies
May 28, 2025
f305d2e
bug fix: if mach_absolute_time returns the same number as the previou…
Jun 19, 2025
95d2353
add dep on rayon
Jun 19, 2025
64ec260
if estimate would return NaN due to dividing by 0, then instead divid…
Jun 19, 2025
a7d6fe5
make a unit test go from red to green, by checking if the measured ti…
Jun 19, 2025
94f4a92
follow-on to the previous patch. This adds the same behavior to every…
Jun 19, 2025
bca5938
make WallTime Measurement return 1 nanosecond if its elapsed time is …
Jun 21, 2025
02c0d07
make RDTSCP satisfy the "measurements must be greater than 0" require…
Jun 21, 2025
1aaee9f
add debug_asserts that the Measurement object satisfies the new contr…
Jun 21, 2025
01b895f
Do the same hack with elapsed_time that the recent patches do to Meas…
Jun 21, 2025
8321601
add assertions that there are not NaN's or Infinites in various float…
Jun 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ categories = ["development-tools::profiling"]
license = "Apache-2.0 OR MIT"
exclude = ["book/*"]

[lints.clippy]
uninlined_format_args = "allow"

[dependencies]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps move the format_arg changes to a separate PR?

anes = "0.1.4"
criterion-plot = { path = "plot", version = "0.5.0" }
Expand All @@ -35,6 +38,13 @@ cast = "0.3"
num-traits = { version = "0.2", default-features = false, features = ["std"] }
oorandom = "11.1"
regex = { version = "1.5.1", default-features = false, features = ["std"] }
rayon = "1.3"

[target.'cfg(target_vendor="apple")'.dependencies]
mach-sys = "0.5"

[target.'cfg(target_arch="x86_64")'.dependencies]
cpuid = "0.1.1"

# Optional dependencies
rayon = { version = "1.3", optional = true }
Expand Down
12 changes: 6 additions & 6 deletions plot/src/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,27 +159,27 @@ impl Script for (Axis, &Properties) {
let axis_ = axis.display();

let mut script = if properties.hidden {
return format!("unset {}tics\n", axis_);
return format!("unset {axis_}tics\n");
} else {
format!("set {}tics nomirror ", axis_)
format!("set {axis_}tics nomirror ")
};

if let Some(ref tics) = properties.tics {
script.push_str(&format!("({})", tics))
script.push_str(&format!("({tics})"))
}

script.push('\n');

if let Some(ref label) = properties.label {
script.push_str(&format!("set {}label '{}'\n", axis_, label))
script.push_str(&format!("set {axis_}label '{label}'\n"))
}

if let Some((low, high)) = properties.range {
script.push_str(&format!("set {}range [{}:{}]\n", axis_, low, high))
script.push_str(&format!("set {axis_}range [{low}:{high}]\n"))
}

if properties.logarithmic {
script.push_str(&format!("set logscale {}\n", axis_));
script.push_str(&format!("set logscale {axis_}\n"));
}

for (grid, properties) in properties.grids.iter() {
Expand Down
2 changes: 1 addition & 1 deletion plot/src/candlestick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Script for Properties {
script.push_str(&format!("lt {} ", self.line_type.display()));

if let Some(lw) = self.linewidth {
script.push_str(&format!("lw {} ", lw))
script.push_str(&format!("lw {lw} "))
}

if let Some(color) = self.color {
Expand Down
4 changes: 2 additions & 2 deletions plot/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Script for Properties {
script.push_str(&format!("lt {} ", self.line_type.display()));

if let Some(lw) = self.linewidth {
script.push_str(&format!("lw {} ", lw))
script.push_str(&format!("lw {lw} "))
}

if let Some(color) = self.color {
Expand All @@ -60,7 +60,7 @@ impl Script for Properties {
}

if let Some(ps) = self.point_size {
script.push_str(&format!("ps {} ", ps))
script.push_str(&format!("ps {ps} "))
}

if let Some(ref label) = self.label {
Expand Down
2 changes: 1 addition & 1 deletion plot/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Display<Cow<'static, str>> for Color {
Color::Green => Cow::from("green"),
Color::Magenta => Cow::from("magenta"),
Color::Red => Cow::from("red"),
Color::Rgb(r, g, b) => Cow::from(format!("#{:02x}{:02x}{:02x}", r, g, b)),
Color::Rgb(r, g, b) => Cow::from(format!("#{r:02x}{g:02x}{b:02x}")),
Color::White => Cow::from("white"),
Color::Yellow => Cow::from("yellow"),
}
Expand Down
4 changes: 2 additions & 2 deletions plot/src/errorbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Script for Properties {
script.push_str(&format!("lt {} ", self.line_type.display()));

if let Some(lw) = self.linewidth {
script.push_str(&format!("lw {} ", lw))
script.push_str(&format!("lw {lw} "))
}

if let Some(color) = self.color {
Expand All @@ -53,7 +53,7 @@ impl Script for Properties {
}

if let Some(ps) = self.point_size {
script.push_str(&format!("ps {} ", ps))
script.push_str(&format!("ps {ps} "))
}

if let Some(ref label) = self.label {
Expand Down
2 changes: 1 addition & 1 deletion plot/src/filledcurve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Script for Properties {
script.push_str("fillstyle ");

if let Some(opacity) = self.opacity {
script.push_str(&format!("solid {} ", opacity))
script.push_str(&format!("solid {opacity} "))
}

// TODO border shoulde be configurable
Expand Down
2 changes: 1 addition & 1 deletion plot/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Script for (Axis, Grid, &Properties) {
if properties.hidden {
String::new()
} else {
format!("set grid {}{}tics\n", grid, axis)
format!("set grid {grid}{axis}tics\n")
}
}
}
2 changes: 1 addition & 1 deletion plot/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Script for Properties {
}

if let Some(ref title) = self.title {
script.push_str(&format!("title '{}' ", title))
script.push_str(&format!("title '{title}' "))
}

if self.boxed {
Expand Down
20 changes: 9 additions & 11 deletions plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,11 @@ impl Figure {
));

if let Some(width) = self.box_width {
s.push_str(&format!("set boxwidth {}\n", width))
s.push_str(&format!("set boxwidth {width}\n"))
}

if let Some(ref title) = self.title {
s.push_str(&format!("set title '{}'\n", title))
s.push_str(&format!("set title '{title}'\n"))
}

for axis in self.axes.iter() {
Expand All @@ -461,20 +461,20 @@ impl Figure {
}

if let Some(alpha) = self.alpha {
s.push_str(&format!("set style fill transparent solid {}\n", alpha))
s.push_str(&format!("set style fill transparent solid {alpha}\n"))
}

s.push_str(&format!("set terminal {} dashed", self.terminal.display()));

if let Some((width, height)) = self.size {
s.push_str(&format!(" size {}, {}", width, height))
s.push_str(&format!(" size {width}, {height}"))
}

if let Some(ref name) = self.font {
if let Some(size) = self.font_size {
s.push_str(&format!(" font '{},{}'", name, size))
s.push_str(&format!(" font '{name},{size}'"))
} else {
s.push_str(&format!(" font '{}'", name))
s.push_str(&format!(" font '{name}'"))
}
}

Expand Down Expand Up @@ -936,16 +936,14 @@ pub enum VersionError {
impl fmt::Display for VersionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
VersionError::Exec(err) => write!(f, "`gnuplot --version` failed: {}", err),
VersionError::Exec(err) => write!(f, "`gnuplot --version` failed: {err}"),
VersionError::Error(msg) => {
write!(f, "`gnuplot --version` failed with error message:\n{}", msg)
write!(f, "`gnuplot --version` failed with error message:\n{msg}")
}
VersionError::OutputError => write!(f, "`gnuplot --version` returned invalid utf-8"),
VersionError::ParseError(msg) => write!(
f,
"`gnuplot --version` returned an unparsable version string: {}",
msg
),
"`gnuplot --version` returned an unparsable version string: {msg}"),
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/analysis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub(crate) fn common<M: Measurement, T: ?Sized>(
match loaded {
Err(err) => panic!(
"Baseline '{base}' must exist before it can be loaded; try --save-baseline {base}. Error: {err}",
base = baseline, err = err
base=criterion.baseline_directory,
),
Ok(samples) => {
sampling_mode = samples.sampling_mode;
Expand Down Expand Up @@ -121,6 +121,14 @@ pub(crate) fn common<M: Measurement, T: ?Sized>(
return;
}

if times.contains(&f64::NAN) {
error!(
"At least one measurement of benchmark {} had a NAN.",
id.as_title()
);
return;
}

let avg_times = iters
.iter()
.zip(times.iter())
Expand Down
Loading