From 90170f9dfa66209c483569472baf48d6b1bb26da Mon Sep 17 00:00:00 2001 From: Denis Bazhenov Date: Sun, 5 Jan 2025 16:46:43 +0100 Subject: [PATCH] Add error descriptions --- tango-bench/src/cli.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tango-bench/src/cli.rs b/tango-bench/src/cli.rs index 74339f3..fb6f977 100644 --- a/tango-bench/src/cli.rs +++ b/tango-bench/src/cli.rs @@ -464,7 +464,7 @@ mod paired_test { let mut spi_self = Spi::for_self(mode).ok_or(Error::SpiSelfWasMoved)?; let mut spi_lib = Spi::for_library(&path, mode) - .with_context(|| format!("Unable to load library: {}", path.display()))?; + .with_context(|| format!("Unale to load library: {}", path.display()))?; settings.filter_outliers = filter_outliers; settings.cache_firewall = cache_firewall; @@ -601,12 +601,24 @@ mod paired_test { let seed = seed.unwrap_or_else(rand::random); - a_func.spi.prepare_state(seed)?; - let a_iters = a_func.spi.estimate_iterations(TIME_SLICE_MS)?; + a_func + .spi + .prepare_state(seed) + .context("Unable to prepare benchmark state")?; + let a_iters = a_func + .spi + .estimate_iterations(TIME_SLICE_MS) + .context("Failed to estimate required iterations number")?; let a_estimate = (a_iters / 2).max(1); - b_func.spi.prepare_state(seed)?; - let b_iters = b_func.spi.estimate_iterations(TIME_SLICE_MS)?; + b_func + .spi + .prepare_state(seed) + .context("Unable to prepare benchmark state")?; + let b_iters = b_func + .spi + .estimate_iterations(TIME_SLICE_MS) + .context("Failed to estimate required iterations number")?; let b_estimate = (b_iters / 2).max(1); let mut iterations_per_sample = a_estimate.min(b_estimate);