mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: add metrics for UDP PPS
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -129,7 +129,7 @@ pub struct PerformanceTestControl {
|
|||||||
test_iterations: u32,
|
test_iterations: u32,
|
||||||
num_queues: Option<u32>,
|
num_queues: Option<u32>,
|
||||||
queue_size: Option<u32>,
|
queue_size: Option<u32>,
|
||||||
net_rx: Option<bool>,
|
net_control: Option<(bool, bool)>, // First bool is for RX(true)/TX(false), second bool is for bandwidth or PPS
|
||||||
fio_control: Option<(FioOps, bool)>, // Second parameter controls whether we want bandwidth or IOPS
|
fio_control: Option<(FioOps, bool)>, // Second parameter controls whether we want bandwidth or IOPS
|
||||||
num_boot_vcpus: Option<u8>,
|
num_boot_vcpus: Option<u8>,
|
||||||
}
|
}
|
||||||
@@ -146,8 +146,9 @@ impl fmt::Display for PerformanceTestControl {
|
|||||||
if let Some(o) = self.queue_size {
|
if let Some(o) = self.queue_size {
|
||||||
output = format!("{output}, queue_size = {o}");
|
output = format!("{output}, queue_size = {o}");
|
||||||
}
|
}
|
||||||
if let Some(o) = self.net_rx {
|
if let Some(o) = self.net_control {
|
||||||
output = format!("{output}, net_rx = {o}");
|
let (rx, bw) = o;
|
||||||
|
output = format!("{output}, rx = {rx}, bandwidth = {bw}");
|
||||||
}
|
}
|
||||||
if let Some(o) = &self.fio_control {
|
if let Some(o) = &self.fio_control {
|
||||||
let (ops, bw) = o;
|
let (ops, bw) = o;
|
||||||
@@ -165,7 +166,7 @@ impl PerformanceTestControl {
|
|||||||
test_iterations: 5,
|
test_iterations: 5,
|
||||||
num_queues: None,
|
num_queues: None,
|
||||||
queue_size: None,
|
queue_size: None,
|
||||||
net_rx: None,
|
net_control: None,
|
||||||
fio_control: None,
|
fio_control: None,
|
||||||
num_boot_vcpus: Some(1),
|
num_boot_vcpus: Some(1),
|
||||||
}
|
}
|
||||||
@@ -263,7 +264,7 @@ mod adjuster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TEST_LIST: [PerformanceTest; 25] = [
|
const TEST_LIST: [PerformanceTest; 29] = [
|
||||||
PerformanceTest {
|
PerformanceTest {
|
||||||
name: "boot_time_ms",
|
name: "boot_time_ms",
|
||||||
func_ptr: performance_boot_time,
|
func_ptr: performance_boot_time,
|
||||||
@@ -322,7 +323,7 @@ const TEST_LIST: [PerformanceTest; 25] = [
|
|||||||
control: PerformanceTestControl {
|
control: PerformanceTestControl {
|
||||||
num_queues: Some(2),
|
num_queues: Some(2),
|
||||||
queue_size: Some(256),
|
queue_size: Some(256),
|
||||||
net_rx: Some(true),
|
net_control: Some((true, true)),
|
||||||
..PerformanceTestControl::default()
|
..PerformanceTestControl::default()
|
||||||
},
|
},
|
||||||
unit_adjuster: adjuster::bps_to_gbps,
|
unit_adjuster: adjuster::bps_to_gbps,
|
||||||
@@ -333,7 +334,7 @@ const TEST_LIST: [PerformanceTest; 25] = [
|
|||||||
control: PerformanceTestControl {
|
control: PerformanceTestControl {
|
||||||
num_queues: Some(2),
|
num_queues: Some(2),
|
||||||
queue_size: Some(256),
|
queue_size: Some(256),
|
||||||
net_rx: Some(false),
|
net_control: Some((false, true)),
|
||||||
..PerformanceTestControl::default()
|
..PerformanceTestControl::default()
|
||||||
},
|
},
|
||||||
unit_adjuster: adjuster::bps_to_gbps,
|
unit_adjuster: adjuster::bps_to_gbps,
|
||||||
@@ -344,7 +345,7 @@ const TEST_LIST: [PerformanceTest; 25] = [
|
|||||||
control: PerformanceTestControl {
|
control: PerformanceTestControl {
|
||||||
num_queues: Some(4),
|
num_queues: Some(4),
|
||||||
queue_size: Some(256),
|
queue_size: Some(256),
|
||||||
net_rx: Some(true),
|
net_control: Some((true, true)),
|
||||||
..PerformanceTestControl::default()
|
..PerformanceTestControl::default()
|
||||||
},
|
},
|
||||||
unit_adjuster: adjuster::bps_to_gbps,
|
unit_adjuster: adjuster::bps_to_gbps,
|
||||||
@@ -355,11 +356,55 @@ const TEST_LIST: [PerformanceTest; 25] = [
|
|||||||
control: PerformanceTestControl {
|
control: PerformanceTestControl {
|
||||||
num_queues: Some(4),
|
num_queues: Some(4),
|
||||||
queue_size: Some(256),
|
queue_size: Some(256),
|
||||||
net_rx: Some(false),
|
net_control: Some((false, true)),
|
||||||
..PerformanceTestControl::default()
|
..PerformanceTestControl::default()
|
||||||
},
|
},
|
||||||
unit_adjuster: adjuster::bps_to_gbps,
|
unit_adjuster: adjuster::bps_to_gbps,
|
||||||
},
|
},
|
||||||
|
PerformanceTest {
|
||||||
|
name: "virtio_net_throughput_single_queue_rx_pps",
|
||||||
|
func_ptr: performance_net_throughput,
|
||||||
|
control: PerformanceTestControl {
|
||||||
|
num_queues: Some(2),
|
||||||
|
queue_size: Some(256),
|
||||||
|
net_control: Some((true, false)),
|
||||||
|
..PerformanceTestControl::default()
|
||||||
|
},
|
||||||
|
unit_adjuster: adjuster::identity,
|
||||||
|
},
|
||||||
|
PerformanceTest {
|
||||||
|
name: "virtio_net_throughput_single_queue_tx_pps",
|
||||||
|
func_ptr: performance_net_throughput,
|
||||||
|
control: PerformanceTestControl {
|
||||||
|
num_queues: Some(2),
|
||||||
|
queue_size: Some(256),
|
||||||
|
net_control: Some((false, false)),
|
||||||
|
..PerformanceTestControl::default()
|
||||||
|
},
|
||||||
|
unit_adjuster: adjuster::identity,
|
||||||
|
},
|
||||||
|
PerformanceTest {
|
||||||
|
name: "virtio_net_throughput_multi_queue_rx_pps",
|
||||||
|
func_ptr: performance_net_throughput,
|
||||||
|
control: PerformanceTestControl {
|
||||||
|
num_queues: Some(4),
|
||||||
|
queue_size: Some(256),
|
||||||
|
net_control: Some((true, false)),
|
||||||
|
..PerformanceTestControl::default()
|
||||||
|
},
|
||||||
|
unit_adjuster: adjuster::identity,
|
||||||
|
},
|
||||||
|
PerformanceTest {
|
||||||
|
name: "virtio_net_throughput_multi_queue_tx_pps",
|
||||||
|
func_ptr: performance_net_throughput,
|
||||||
|
control: PerformanceTestControl {
|
||||||
|
num_queues: Some(4),
|
||||||
|
queue_size: Some(256),
|
||||||
|
net_control: Some((false, false)),
|
||||||
|
..PerformanceTestControl::default()
|
||||||
|
},
|
||||||
|
unit_adjuster: adjuster::identity,
|
||||||
|
},
|
||||||
PerformanceTest {
|
PerformanceTest {
|
||||||
name: "block_read_MiBps",
|
name: "block_read_MiBps",
|
||||||
func_ptr: performance_block_io,
|
func_ptr: performance_block_io,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ fn direct_kernel_boot_path() -> PathBuf {
|
|||||||
|
|
||||||
pub fn performance_net_throughput(control: &PerformanceTestControl) -> f64 {
|
pub fn performance_net_throughput(control: &PerformanceTestControl) -> f64 {
|
||||||
let test_timeout = control.test_timeout;
|
let test_timeout = control.test_timeout;
|
||||||
let rx = control.net_rx.unwrap();
|
let (rx, bandwidth) = control.net_control.unwrap();
|
||||||
|
|
||||||
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||||
let guest = performance_test_new_guest(Box::new(focal));
|
let guest = performance_test_new_guest(Box::new(focal));
|
||||||
@@ -105,7 +105,7 @@ pub fn performance_net_throughput(control: &PerformanceTestControl) -> f64 {
|
|||||||
|
|
||||||
let r = std::panic::catch_unwind(|| {
|
let r = std::panic::catch_unwind(|| {
|
||||||
guest.wait_vm_boot(None).unwrap();
|
guest.wait_vm_boot(None).unwrap();
|
||||||
measure_virtio_net_throughput(test_timeout, num_queues / 2, &guest, rx, true).unwrap()
|
measure_virtio_net_throughput(test_timeout, num_queues / 2, &guest, rx, bandwidth).unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = child.kill();
|
let _ = child.kill();
|
||||||
|
|||||||
Reference in New Issue
Block a user