diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2016-05-24 08:21:05 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-06-06 06:00:11 -0400 |
commit | 139ab4d4e68b8cf2a611b06c006a2195dc6bedf1 (patch) | |
tree | 0b76e1eb29428e055efd3b2adaef2753de4809af /tools | |
parent | ef1b144d23dbd745fd655b7d0a70212fcc8d0121 (diff) |
tools/virtio: add noring tool
Useful to measure testing framework overhead.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virtio/ringtest/Makefile | 4 | ||||
-rw-r--r-- | tools/virtio/ringtest/noring.c | 69 |
2 files changed, 72 insertions, 1 deletions
diff --git a/tools/virtio/ringtest/Makefile b/tools/virtio/ringtest/Makefile index 6ba745529833..6173adae9f08 100644 --- a/tools/virtio/ringtest/Makefile +++ b/tools/virtio/ringtest/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | all: | 1 | all: |
2 | 2 | ||
3 | all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder | 3 | all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder noring |
4 | 4 | ||
5 | CFLAGS += -Wall | 5 | CFLAGS += -Wall |
6 | CFLAGS += -pthread -O2 -ggdb | 6 | CFLAGS += -pthread -O2 -ggdb |
@@ -15,11 +15,13 @@ ring: ring.o main.o | |||
15 | virtio_ring_0_9: virtio_ring_0_9.o main.o | 15 | virtio_ring_0_9: virtio_ring_0_9.o main.o |
16 | virtio_ring_poll: virtio_ring_poll.o main.o | 16 | virtio_ring_poll: virtio_ring_poll.o main.o |
17 | virtio_ring_inorder: virtio_ring_inorder.o main.o | 17 | virtio_ring_inorder: virtio_ring_inorder.o main.o |
18 | noring: noring.o main.o | ||
18 | clean: | 19 | clean: |
19 | -rm main.o | 20 | -rm main.o |
20 | -rm ring.o ring | 21 | -rm ring.o ring |
21 | -rm virtio_ring_0_9.o virtio_ring_0_9 | 22 | -rm virtio_ring_0_9.o virtio_ring_0_9 |
22 | -rm virtio_ring_poll.o virtio_ring_poll | 23 | -rm virtio_ring_poll.o virtio_ring_poll |
23 | -rm virtio_ring_inorder.o virtio_ring_inorder | 24 | -rm virtio_ring_inorder.o virtio_ring_inorder |
25 | -rm noring.o noring | ||
24 | 26 | ||
25 | .PHONY: all clean | 27 | .PHONY: all clean |
diff --git a/tools/virtio/ringtest/noring.c b/tools/virtio/ringtest/noring.c new file mode 100644 index 000000000000..eda2f4824130 --- /dev/null +++ b/tools/virtio/ringtest/noring.c | |||
@@ -0,0 +1,69 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include "main.h" | ||
3 | #include <assert.h> | ||
4 | |||
5 | /* stub implementation: useful for measuring overhead */ | ||
6 | void alloc_ring(void) | ||
7 | { | ||
8 | } | ||
9 | |||
10 | /* guest side */ | ||
11 | int add_inbuf(unsigned len, void *buf, void *datap) | ||
12 | { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | /* | ||
17 | * skb_array API provides no way for producer to find out whether a given | ||
18 | * buffer was consumed. Our tests merely require that a successful get_buf | ||
19 | * implies that add_inbuf succeed in the past, and that add_inbuf will succeed, | ||
20 | * fake it accordingly. | ||
21 | */ | ||
22 | void *get_buf(unsigned *lenp, void **bufp) | ||
23 | { | ||
24 | return "Buffer"; | ||
25 | } | ||
26 | |||
27 | void poll_used(void) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | void disable_call() | ||
32 | { | ||
33 | assert(0); | ||
34 | } | ||
35 | |||
36 | bool enable_call() | ||
37 | { | ||
38 | assert(0); | ||
39 | } | ||
40 | |||
41 | void kick_available(void) | ||
42 | { | ||
43 | assert(0); | ||
44 | } | ||
45 | |||
46 | /* host side */ | ||
47 | void disable_kick() | ||
48 | { | ||
49 | assert(0); | ||
50 | } | ||
51 | |||
52 | bool enable_kick() | ||
53 | { | ||
54 | assert(0); | ||
55 | } | ||
56 | |||
57 | void poll_avail(void) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | bool use_buf(unsigned *lenp, void **bufp) | ||
62 | { | ||
63 | return true; | ||
64 | } | ||
65 | |||
66 | void call_used(void) | ||
67 | { | ||
68 | assert(0); | ||
69 | } | ||