From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx141.netapp.com (mx141.netapp.com [216.240.21.12]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mx141.netapp.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by huchra.bufferbloat.net (Postfix) with ESMTPS id 64EB221F55B for ; Fri, 17 Apr 2015 07:46:19 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.11,595,1422950400"; d="asc'?scan'208";a="37265199" Received: from hioexcmbx04-prd.hq.netapp.com ([10.122.105.37]) by mx141-out.netapp.com with ESMTP; 17 Apr 2015 07:46:00 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com (10.122.105.40) by hioexcmbx04-prd.hq.netapp.com (10.122.105.37) with Microsoft SMTP Server (TLS) id 15.0.995.29; Fri, 17 Apr 2015 07:45:59 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com ([::1]) by hioexcmbx07-prd.hq.netapp.com ([fe80::f07f:691d:89d:53b7%21]) with mapi id 15.00.0995.031; Fri, 17 Apr 2015 07:45:59 -0700 From: "Eggert, Lars" To: bloat Thread-Topic: RRUL for netperf (bad hack) Thread-Index: AQHQeR03XD8sxAGfOUKDFaXFrUm+Tg== Date: Fri, 17 Apr 2015 14:45:58 +0000 Message-ID: <880D8FBB-3C10-451D-8EB5-50D0A65B9704@netapp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.2098) x-originating-ip: [10.122.56.79] Content-Type: multipart/signed; boundary="Apple-Mail=_E75644AE-7326-47A6-80D6-DD6D75079E8E"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 Subject: [Bloat] RRUL for netperf (bad hack) X-BeenThere: bloat@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: General list for discussing Bufferbloat List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 14:46:50 -0000 --Apple-Mail=_E75644AE-7326-47A6-80D6-DD6D75079E8E Content-Type: multipart/mixed; boundary="Apple-Mail=_BF29552E-539F-490F-8B68-D1FA849C2E63" --Apple-Mail=_BF29552E-539F-490F-8B68-D1FA849C2E63 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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 --Apple-Mail=_BF29552E-539F-490F-8B68-D1FA849C2E63 Content-Disposition: attachment; filename=nettest_omni.c.patch Content-Type: application/octet-stream; name="nettest_omni.c.patch" Content-Transfer-Encoding: 7bit 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 #endif +#include #include #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 --Apple-Mail=_BF29552E-539F-490F-8B68-D1FA849C2E63-- --Apple-Mail=_E75644AE-7326-47A6-80D6-DD6D75079E8E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlUxHKUACgkQIWcjmsUTWRpzFQCg/cJtiq58d9A9TbfMFbb5bFvp FC8AoOjofGObM0EiR81GIXiMP5d6ZR2H =R9N8 -----END PGP SIGNATURE----- --Apple-Mail=_E75644AE-7326-47A6-80D6-DD6D75079E8E--