mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: Add micro benchmark support
Introduce support for in process micro benchmarks alongside the existing VM level performance tests. Micro benchmarks are integrated into the same PerformanceTest/TEST_LIST infrastructure and follow the same iteration, timeout, and reporting pipeline. They are distinguished by a micro_* name prefix. The test dispatch loop is refactored to pre filter the test list and gate init/cleanup behind a flag, so that pure micro benchmark runs skip the expensive VM lifecycle entirely. Mixed runs (VM + micro) continue to work correctly. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -1338,24 +1338,35 @@ fn main() {
|
||||
.unwrap_or_default(),
|
||||
});
|
||||
|
||||
init_tests(&overrides);
|
||||
// Determine which tests will actually run.
|
||||
let tests_to_run: Vec<&&PerformanceTest> = test_list
|
||||
.iter()
|
||||
.filter(|t| test_filter.is_empty() || test_filter.iter().any(|&s| t.name.contains(s)))
|
||||
.collect();
|
||||
|
||||
for test in test_list.iter() {
|
||||
if test_filter.is_empty() || test_filter.iter().any(|&s| test.name.contains(s)) {
|
||||
settle_host();
|
||||
match run_test_with_timeout(test, &overrides) {
|
||||
Ok(r) => {
|
||||
metrics_report.results.push(r);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Aborting test due to error: '{e:?}'");
|
||||
std::process::exit(1);
|
||||
}
|
||||
// Skip heavy VM level init/cleanup when only micro benchmarks are selected.
|
||||
let needs_vm_tests = tests_to_run.iter().any(|t| !t.name.starts_with("micro_"));
|
||||
|
||||
if needs_vm_tests {
|
||||
init_tests(&overrides);
|
||||
}
|
||||
|
||||
for test in tests_to_run {
|
||||
settle_host();
|
||||
match run_test_with_timeout(test, &overrides) {
|
||||
Ok(r) => {
|
||||
metrics_report.results.push(r);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Aborting test due to error: '{e:?}'");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup_tests();
|
||||
if needs_vm_tests {
|
||||
cleanup_tests();
|
||||
}
|
||||
|
||||
let mut report_file: Box<dyn std::io::Write + Send> =
|
||||
if let Some(file) = cmd_arguments.get_one::<String>("report-file") {
|
||||
|
||||
Reference in New Issue
Block a user