Skip to content

Commit 8abbffd

Browse files
Arseniy KrasnovPaolo Abeni
authored andcommitted
test/vsock: vsock_perf utility
This adds utility to check vsock rx/tx performance. Usage as sender: ./vsock_perf --sender <cid> --port <port> --bytes <bytes to send> Usage as receiver: ./vsock_perf --port <port> --rcvlowat <SO_RCVLOWAT> Signed-off-by: Arseniy Krasnov <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 685a21c commit 8abbffd

File tree

3 files changed

+463
-1
lines changed

3 files changed

+463
-1
lines changed

tools/testing/vsock/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
all: test
2+
all: test vsock_perf
33
test: vsock_test vsock_diag_test
44
vsock_test: vsock_test.o timeout.o control.o util.o
55
vsock_diag_test: vsock_diag_test.o timeout.o control.o util.o
6+
vsock_perf: vsock_perf.o
67

78
CFLAGS += -g -O2 -Werror -Wall -I. -I../../include -I../../../usr/include -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -D_GNU_SOURCE
89
.PHONY: all test clean

tools/testing/vsock/README

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,37 @@ Invoke test binaries in both directions as follows:
3535
--control-port=$GUEST_IP \
3636
--control-port=1234 \
3737
--peer-cid=3
38+
39+
vsock_perf utility
40+
-------------------
41+
'vsock_perf' is a simple tool to measure vsock performance. It works in
42+
sender/receiver modes: sender connect to peer at the specified port and
43+
starts data transmission to the receiver. After data processing is done,
44+
it prints several metrics(see below).
45+
46+
Usage:
47+
# run as sender
48+
# connect to CID 2, port 1234, send 1G of data, tx buf size is 1M
49+
./vsock_perf --sender 2 --port 1234 --bytes 1G --buf-size 1M
50+
51+
Output:
52+
tx performance: A Gbits/s
53+
54+
Output explanation:
55+
A is calculated as "number of bits to send" / "time in tx loop"
56+
57+
# run as receiver
58+
# listen port 1234, rx buf size is 1M, socket buf size is 1G, SO_RCVLOWAT is 64K
59+
./vsock_perf --port 1234 --buf-size 1M --vsk-size 1G --rcvlowat 64K
60+
61+
Output:
62+
rx performance: A Gbits/s
63+
total in 'read()': B sec
64+
POLLIN wakeups: C
65+
average in 'read()': D ns
66+
67+
Output explanation:
68+
A is calculated as "number of received bits" / "time in rx loop".
69+
B is time, spent in 'read()' system call(excluding 'poll()')
70+
C is number of 'poll()' wake ups with POLLIN bit set.
71+
D is B / C, e.g. average amount of time, spent in single 'read()'.

0 commit comments

Comments
 (0)