From b12620cf2545a97b930b44f505f05890eef77baf Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 15 Mar 2026 11:47:37 +0100 Subject: [PATCH] performance-metrics: Add num_ops field to PerformanceTestControl Add an optional num_ops parameter for micro benchmarks to configure workload size (e.g. number of AIO operations to submit). A warning is emitted if it is accidentally set on a non micro test where it has no effect. Signed-off-by: Anatol Belski --- performance-metrics/src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index d1228153d..cdc06fe10 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -179,6 +179,7 @@ pub struct PerformanceTestControl { net_control: Option<(bool, bool)>, // First bool is for RX(true)/TX(false), second bool is for bandwidth or PPS block_control: Option, num_boot_vcpus: Option, + num_ops: Option, // Workload size for micro benchmarks } impl fmt::Display for PerformanceTestControl { @@ -203,6 +204,9 @@ impl fmt::Display for PerformanceTestControl { o.fio_ops, o.bandwidth, o.test_file ); } + if let Some(o) = self.num_ops { + output = format!("{output}, num_ops = {o}"); + } write!(f, "{output}") } @@ -219,6 +223,7 @@ impl PerformanceTestControl { net_control: None, block_control: None, num_boot_vcpus: Some(1), + num_ops: None, } } } @@ -235,6 +240,13 @@ struct PerformanceTest { impl PerformanceTest { pub fn run(&self, overrides: &PerformanceTestOverrides) -> PerformanceTestResult { + if self.control.num_ops.is_some() && !self.name.starts_with("micro_") { + eprintln!( + "Warning: num_ops is set on '{}' but has no effect on non micro benchmarks", + self.name + ); + } + // Run warmup iterations if configured (results discarded) for _ in 0..self.control.warmup_iterations { if let Some(test_timeout) = overrides.test_timeout {