mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: net: Implement counters for network traffic
Add counters for RX/TX bytes and RX/TX frames. These are collected on a per queue basis and then accumulated into an atomic shared value across the different threads for the device as a whole. Collecting and accumulating these counters makes minimal difference in the iperf results. Any difference seen is within what is observed as natural variation in this test. e.g. With counter updates: $ iperf3 -c 192.168.249.2 Connecting to host 192.168.249.2, port 5201 [ 5] local 192.168.249.1 port 52706 connected to 192.168.249.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 6.19 GBytes 53.2 Gbits/sec 0 3.01 MBytes [ 5] 1.00-2.00 sec 6.31 GBytes 54.2 Gbits/sec 0 3.01 MBytes [ 5] 2.00-3.00 sec 6.29 GBytes 54.0 Gbits/sec 0 3.01 MBytes [ 5] 3.00-4.00 sec 6.22 GBytes 53.4 Gbits/sec 0 3.01 MBytes [ 5] 4.00-5.00 sec 6.14 GBytes 52.8 Gbits/sec 0 3.01 MBytes [ 5] 5.00-6.00 sec 6.13 GBytes 52.7 Gbits/sec 0 3.01 MBytes [ 5] 6.00-7.00 sec 6.20 GBytes 53.3 Gbits/sec 0 3.01 MBytes [ 5] 7.00-8.00 sec 6.16 GBytes 52.9 Gbits/sec 0 3.01 MBytes [ 5] 8.00-9.00 sec 6.13 GBytes 52.6 Gbits/sec 0 3.01 MBytes [ 5] 9.00-10.00 sec 6.15 GBytes 52.8 Gbits/sec 0 3.01 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 61.9 GBytes 53.2 Gbits/sec 0 sender [ 5] 0.00-10.00 sec 61.9 GBytes 53.2 Gbits/sec receiver iperf Done. Without counter updates: $ iperf3 -c 192.168.249.2 Connecting to host 192.168.249.2, port 5201 [ 5] local 192.168.249.1 port 52716 connected to 192.168.249.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 6.29 GBytes 54.1 Gbits/sec 0 3.03 MBytes [ 5] 1.00-2.00 sec 6.18 GBytes 53.1 Gbits/sec 0 3.03 MBytes [ 5] 2.00-3.00 sec 6.26 GBytes 53.8 Gbits/sec 0 3.03 MBytes [ 5] 3.00-4.00 sec 6.24 GBytes 53.6 Gbits/sec 0 3.03 MBytes [ 5] 4.00-5.00 sec 6.27 GBytes 53.9 Gbits/sec 1 3.03 MBytes [ 5] 5.00-6.00 sec 6.31 GBytes 54.2 Gbits/sec 0 3.03 MBytes [ 5] 6.00-7.00 sec 6.29 GBytes 54.1 Gbits/sec 0 3.03 MBytes [ 5] 7.00-8.00 sec 6.16 GBytes 52.9 Gbits/sec 0 3.03 MBytes [ 5] 8.00-9.00 sec 6.13 GBytes 52.6 Gbits/sec 0 3.03 MBytes [ 5] 9.00-10.00 sec 6.25 GBytes 53.7 Gbits/sec 0 3.03 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 62.4 GBytes 53.6 Gbits/sec 1 sender [ 5] 0.00-10.00 sec 62.4 GBytes 53.6 Gbits/sec receiver iperf Done. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
0583ce921b
commit
2b4a0358de
@@ -30,7 +30,7 @@ use virtio_bindings::bindings::virtio_net::*;
|
||||
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
||||
use vm_memory::{GuestMemoryAtomic, GuestMemoryMmap};
|
||||
use vm_virtio::net_util::{open_tap, RxVirtio, TxVirtio};
|
||||
use vm_virtio::NetQueuePair;
|
||||
use vm_virtio::{NetCounters, NetQueuePair};
|
||||
use vmm::config::{OptionParser, OptionParserError};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
@@ -111,6 +111,7 @@ impl VhostUserNetThread {
|
||||
tx: TxVirtio::new(),
|
||||
rx_tap_listening: false,
|
||||
epoll_fd: None,
|
||||
counters: NetCounters::default(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user