General list for discussing Bufferbloat
 help / color / mirror / Atom feed
From: "Eggert, Lars" <lars@netapp.com>
To: bloat <bloat@lists.bufferbloat.net>
Subject: [Bloat] RRUL for netperf (bad hack)
Date: Fri, 17 Apr 2015 14:45:58 +0000	[thread overview]
Message-ID: <880D8FBB-3C10-451D-8EB5-50D0A65B9704@netapp.com> (raw)


[-- 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 --]

             reply	other threads:[~2015-04-17 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 14:45 Eggert, Lars [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/bloat.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=880D8FBB-3C10-451D-8EB5-50D0A65B9704@netapp.com \
    --to=lars@netapp.com \
    --cc=bloat@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox