summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-10-09 09:04:04 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-10-09 09:08:36 +0100
commit11f57c1183ff13c0a22ee26b83d5c8a7505a3060 (patch)
treed55c4261d12b11d36f7edb42a91eb33b4e5c3234
parent188875e401e9f288894eab4389929ce64c65ce3c (diff)
Assure all bandwidth is used with all settings
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--tests/bandwidth.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/bandwidth.c b/tests/bandwidth.c
index efc1416..279126a 100644
--- a/tests/bandwidth.c
+++ b/tests/bandwidth.c
@@ -10,6 +10,7 @@
#define MIN_IP_UDP_HEADER 28
+static unsigned current_bw = 0;
static int udp_socks[2] = { -1, -1 };
typedef struct {
@@ -31,11 +32,8 @@ send_proc(void *arg)
uint64_t start_time = get_time_us();
while (get_time_us() - start_time < 130 * 1000) {
- send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
- send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
- send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
- send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
- send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
+ for (n = current_bw / 4; n >= 0; --n)
+ send(sock, &payload, sizeof(payload), MSG_NOSIGNAL);
usleep(1000);
}
return NULL;
@@ -94,6 +92,8 @@ flush_socks(void)
static void
test_bandwidth(unsigned bw)
{
+ current_bw = bw;
+
pthread_t th[3];
void *thread_res;
unsigned bytes_received;