mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: trim qualified paths
Import the std modules used in the crate instead of spelling the full paths at every use site, and drop the now-unnecessary crate-level #![expect(clippy::absolute_paths)]. Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com> Assisted-by: Claude:Opus-4.8
This commit is contained in:
committed by
Bo Chen
parent
6683ae2d51
commit
427c4de928
@@ -6,7 +6,7 @@
|
||||
// Performance tests
|
||||
|
||||
use std::time::Duration;
|
||||
use std::{fs, thread};
|
||||
use std::{fs, panic, thread};
|
||||
|
||||
use test_infra::{Error as InfraError, *};
|
||||
use thiserror::Error;
|
||||
@@ -156,7 +156,7 @@ pub fn performance_net_throughput(control: &PerformanceTestControl) -> f64 {
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
measure_virtio_net_throughput(test_timeout, num_queues / 2, &guest, rx, bandwidth).unwrap()
|
||||
});
|
||||
@@ -196,7 +196,7 @@ pub fn performance_net_latency(control: &PerformanceTestControl) -> f64 {
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
// 'ethr' tool will measure the latency multiple times with provided test time
|
||||
@@ -217,7 +217,7 @@ pub fn performance_net_latency(control: &PerformanceTestControl) -> f64 {
|
||||
}
|
||||
|
||||
fn parse_boot_time_output(output: &[u8]) -> Result<f64, Error> {
|
||||
std::panic::catch_unwind(|| {
|
||||
panic::catch_unwind(|| {
|
||||
let l: Vec<String> = String::from_utf8_lossy(output)
|
||||
.lines()
|
||||
.filter(|l| l.contains("Debug I/O port: Kernel code"))
|
||||
@@ -320,7 +320,7 @@ fn measure_boot_time(cmd: &mut GuestCommand, test_timeout: u32) -> Result<f64, E
|
||||
}
|
||||
|
||||
pub fn performance_boot_time(control: &PerformanceTestControl) -> f64 {
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
let jammy = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string());
|
||||
let guest = performance_test_new_guest(Box::new(jammy), control);
|
||||
let mut cmd = GuestCommand::new(&guest);
|
||||
@@ -344,7 +344,7 @@ pub fn performance_boot_time(control: &PerformanceTestControl) -> f64 {
|
||||
}
|
||||
|
||||
pub fn performance_boot_time_pmem(control: &PerformanceTestControl) -> f64 {
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
let jammy = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string());
|
||||
let guest = performance_test_new_guest(Box::new(jammy), control);
|
||||
let mut cmd = GuestCommand::new(&guest);
|
||||
@@ -435,7 +435,7 @@ pub fn performance_block_io(control: &PerformanceTestControl) -> f64 {
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
let fio_command = format!(
|
||||
@@ -523,7 +523,7 @@ fn measure_restore_time(
|
||||
}
|
||||
|
||||
pub fn performance_restore_latency(control: &PerformanceTestControl) -> f64 {
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let r = panic::catch_unwind(|| {
|
||||
let jammy = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string());
|
||||
let guest = performance_test_new_guest(Box::new(jammy), control);
|
||||
let api_socket_source = String::from(
|
||||
@@ -548,7 +548,7 @@ pub fn performance_restore_latency(control: &PerformanceTestControl) -> f64 {
|
||||
|
||||
thread::sleep(Duration::new((control.test_timeout / 2) as u64, 0));
|
||||
let snapshot_dir = String::from(guest.tmp_dir.as_path().join("snapshot").to_str().unwrap());
|
||||
std::fs::create_dir(&snapshot_dir).unwrap();
|
||||
fs::create_dir(&snapshot_dir).unwrap();
|
||||
assert!(remote_command(&api_socket_source, "pause", None));
|
||||
assert!(remote_command(
|
||||
&api_socket_source,
|
||||
|
||||
Reference in New Issue
Block a user