Resolve overlap with merged measurement refactors and current master

This commit is contained in:
David Peter authored and David Peter committed 2026-10-05 16:01:30 +02:00
1 parent 7a80feb4b0
commit cf381994d1
8 files changed
+131 -98

No files matched your search

+4 -17
View File
@@ -79,28 +79,15 @@ fn run_command_and_measure_common(
let measurement = execute_and_measure(command)
.with_context(|| format!("Failed to run command '{command_name}'"))?;
if command_failure_action == CmdFailureAction::RaiseError && !measurement.exit_status.success()
{
let when = match iteration {
BenchmarkIteration::NonBenchmarkRun => "a non-benchmark run".to_string(),
BenchmarkIteration::Warmup(0) => "the first warmup run".to_string(),
BenchmarkIteration::Warmup(i) => format!("warmup iteration {i}"),
BenchmarkIteration::Benchmark(0) => "the first benchmark run".to_string(),
BenchmarkIteration::Benchmark(i) => format!("benchmark iteration {i}"),
};
bail!(
"{cause} in {when}. Use the '-i'/'--ignore-failure' option if you want to ignore this. \
Alternatively, use the '--show-output' option to debug what went wrong.",
cause=measurement.exit_status.code().map_or(
"The process has been terminated by a signal".into(),
|c| format!("Command terminated with non-zero exit code {c}")
if !measurement.exit_status.success() {
use crate::util::exit_code::extract_exit_code;
let should_fail = match command_failure_action {
CmdFailureAction::RaiseError => true,
CmdFailureAction::IgnoreAllFailures => false,
CmdFailureAction::IgnoreSpecificFailures(ref codes) => {
// Only fail if the exit code is not in the list of codes to ignore
if let Some(exit_code) = extract_exit_code(result.exit_status) {
if let Some(exit_code) = extract_exit_code(measurement.exit_status) {
!codes.contains(&exit_code)
} else {
// If we can't extract an exit code, treat it as a failure
@@ -120,7 +107,7 @@ fn run_command_and_measure_common(
bail!(
"{cause} in {when}. Use the '-i'/'--ignore-failure' option if you want to ignore this. \
Alternatively, use the '--show-output' option to debug what went wrong.",
cause=result.exit_status.code().map_or(
cause=measurement.exit_status.code().map_or(
"The process has been terminated by a signal".into(),
|c| format!("Command terminated with non-zero exit code {c}")
-4
View File
@@ -115,8 +115,4 @@ impl Measurements {
pub fn peak_memory_usage_mean(&self) -> Information {
mean(self.measurements.iter().map(|m| m.peak_memory_usage))
}
pub fn peak_memory_usage_mean(&self) -> Information {
mean(self.measurements.iter().map(|m| m.peak_memory_usage))
}
}
+3 -1
View File
@@ -379,8 +379,10 @@ impl<'a> Benchmark<'a> {
let system_str = measurements.time_system_mean().format(time_unit);
if self.options.output_style != OutputStyleOption::Disabled {
let mut stdout = io::stdout().lock();
if measurements.len() == 1 {
println!(
console_writeln!(
stdout,
" Time ({} ≡): {:>8} {:>8} [User: {}, System: {}]",
"abs".green().bold(),
mean_str.green().bold(),
+2 -2
View File
@@ -93,7 +93,7 @@ impl<'a> Scheduler<'a> {
stdout,
" {} ran",
reference.result.command_with_unused_parameters().cyan()
);
)?;
for item in others {
let stddev = if let Some(stddev) = item.relative_speed_stddev {
@@ -123,7 +123,7 @@ impl<'a> Scheduler<'a> {
"{} {}",
comparator,
&item.result.command_with_unused_parameters().magenta()
);
)?;
}
}
SortOrder::Command => {