General list for discussing Bufferbloat
 help / color / mirror / Atom feed
* [Bloat] RRUL for netperf (bad hack)
@ 2015-04-17 14:45 Eggert, Lars
  2015-04-17 16:18 ` Bill Ver Steeg (versteb)
  2015-04-18 12:33 ` Toke Høiland-Jørgensen
  0 siblings, 2 replies; 6+ messages in thread
From: Eggert, Lars @ 2015-04-17 14:45 UTC (permalink / raw)
  To: bloat


[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]

Hi,

the attached patch is a horrible, horrible, HORRIBLE hack to add some sort of RRUL testing into netperf. I needed something like this for some quick testing and thought maybe someone else can get some use out of it. (I was interested in the delay an application sees on top of a TCP stream, which is not something Toke's excellent netperf-wrapper tool can currently do, AFAIK.)

I've only really used this with stream tests, and it only produces sensible results with a specific request size such as "-r 16384" or something. And I've only used this on Linux.

Basically, this embeds a timeval into the test stream for each block, echoes it back to the sender, and then prints the application-level RTT seen. (It also prints a one-way delay, but that is only sensible to look at for clocks synchronized to an accuracy much better than the network delay.)

Lars


[-- Attachment #1.2: nettest_omni.c.patch --]
[-- Type: application/octet-stream, Size: 1945 bytes --]

Index: src/nettest_omni.c
===================================================================
--- src/nettest_omni.c	(revision 676)
+++ src/nettest_omni.c	(working copy)
@@ -46,6 +46,7 @@
 #if HAVE_SCHED_H
 # include <sched.h>
 #endif
+#include <poll.h>
 
 #include <fcntl.h>
 #ifndef WIN32
@@ -2990,6 +2991,10 @@
     fflush(where);
   }
 
+#ifdef RTT
+      gettimeofday(send_ring->buffer_ptr, 0);
+#endif
+
   if (destination) {
     if (have_pktinfo) {
       len = send_pktinfo(data_socket,
@@ -3030,6 +3035,25 @@
 #endif
     }
   }
+
+#ifdef RTT
+  struct pollfd fds = { .fd = data_socket, .events = POLLIN };
+  if (poll(&fds, 1, 0) > 0) {
+    struct timeval now;
+    struct timeval before;
+    if (recv(data_socket, &before, sizeof(struct timeval), MSG_WAITALL) == -1) {
+      if(errno != EINTR) {
+        perror("netperf: recv timeval");
+        exit(-1);
+      }
+    }
+    gettimeofday(&now, 0);
+    int rtt = delta_micro(&before, &now);
+    if (rtt > 0)
+      fprintf(stderr, "%d usec RTT\n", rtt);
+  }
+#endif
+
   if(len != bytes_to_send) {
     /* don't forget that some platforms may do a partial send upon
        receipt of the interrupt and not return an EINTR... */
@@ -5790,7 +5814,21 @@
 	}
 	bytes_received += ret;
 	local_receive_calls += temp_recvs;
+
+#ifdef RTT
+        int chunk = bytes_received % bytes_to_recv;
+        if (chunk && chunk < ret) {
+          struct timeval *before = &(recv_ring->buffer_ptr[ret - chunk]);
+          struct timeval now;
+          gettimeofday(&now, 0);
+          fprintf(stderr, "%d usec one-way delay \n", delta_micro(before, &now));
+          if(send(data_socket, before, sizeof(struct timeval), 0) == -1) {
+            perror("netperf: send timeval");
+            exit(-1);
       }
+        }
+#endif
+      }
       else if (ret == 0) {
 	/* is this the end of a test, just a zero-byte recv, or
 	   something else? that is an exceedingly good question and

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-18 12:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17 14:45 [Bloat] RRUL for netperf (bad hack) Eggert, Lars
2015-04-17 16:18 ` Bill Ver Steeg (versteb)
2015-04-17 16:38   ` Eggert, Lars
2015-04-17 17:04     ` Bill Ver Steeg (versteb)
2015-04-17 18:20       ` Dave Taht
2015-04-18 12:33 ` Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox