--- iperf-2.0.4.orig/debian/iperf.install +++ iperf-2.0.4/debian/iperf.install @@ -0,0 +1,3 @@ +doc/dast.gif usr/share/doc/iperf/html +doc/*.html usr/share/doc/iperf/html +src/iperf usr/bin --- iperf-2.0.4.orig/debian/control +++ iperf-2.0.4/debian/control @@ -0,0 +1,32 @@ +Source: iperf +Section: net +Priority: optional +Maintainer: Roberto Lumbreras +Build-Depends: cdbs, debhelper (>= 7), autotools-dev, patchutils +Standards-Version: 3.8.0 +Homepage: http://iperf.sourceforge.net/ + +Package: iperf +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Internet Protocol bandwidth measuring tool + Iperf is a modern alternative for measuring TCP and UDP bandwidth performance, + allowing the tuning of various parameters and characteristics. + . + Features: + * Measure bandwidth, packet loss, delay jitter + * Report MSS/MTU size and observed read sizes. + * Support for TCP window size via socket buffers. + * Multi-threaded. Client and server can have multiple simultaneous + connections. + * Client can create UDP streams of specified bandwidth. + * Multicast and IPv6 capable. + * Options can be specified with K (kilo-) and M (mega-) suffices. + * Can run for specified time, rather than a set amount of data to transfer. + * Picks the best units for the size of data being reported. + * Server handles multiple connections. + * Print periodic, intermediate bandwidth, jitter, and loss reports at + specified intervals. + * Server can be run as a daemon. + * Use representative streams to test out how link layer compression affects + your achievable bandwidth. --- iperf-2.0.4.orig/debian/iperf.doc-base +++ iperf-2.0.4/debian/iperf.doc-base @@ -0,0 +1,10 @@ +Document: iperf +Title: iperf Manual +Author: The Board of Trustees of the University of Illinois +Abstract: Internet bandwidth measuring tool +Section: Network/Monitoring + +Format: HTML +Index: /usr/share/doc/iperf/html/index.html +Files: /usr/share/doc/iperf/html/*.html + --- iperf-2.0.4.orig/debian/rules +++ iperf-2.0.4/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk + --- iperf-2.0.4.orig/debian/watch +++ iperf-2.0.4/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/iperf/iperf-?_?([\w+\d+\.]+|\d+)(?:\.tar|\.tgz)(?:\.gz|\.bz2|) --- iperf-2.0.4.orig/debian/changelog +++ iperf-2.0.4/debian/changelog @@ -0,0 +1,101 @@ +iperf (2.0.4-4) unstable; urgency=low + + * Die instead of warn on bind/connect fatal errors (thanks to Deny IP Any + Any). (closes: #517239, #518033) + * Add missing comma after ${shlibs:Depends} in the control file. Add + Homepage in control file. (thanks to lintian). + + -- Roberto Lumbreras Wed, 04 Mar 2009 12:46:12 +0100 + +iperf (2.0.4-3) unstable; urgency=low + + * Merged in svn r43 including the following changes: + - print report headers only once + ==> drop debian/patches/002-*.patch doing the same. + - replace costly gettimeofday() with nanosleep() + ==> should lower the CPU usage in UDP mode. + * Re-added the Ingo Molnar patch changing thread_rest for Condition_Wait. + * With these two patches the 100% cpu usage in UDP mode is fixed. + (closes: #496865) + + -- Roberto Lumbreras Thu, 28 Aug 2008 16:17:46 +0200 + +iperf (2.0.4-2) unstable; urgency=low + + * Updated standards. Set debhelper compatibility level to 7. + * iperf.1: fix minus/hyphen issues. + + -- Roberto Lumbreras Thu, 21 Aug 2008 00:38:16 +0200 + +iperf (2.0.4-1) unstable; urgency=low + + * New upstream version. (closes: #480000) + * Deleted performance problem patch, it is now fixed upstream. + * Deleted debian specific manpage, the package has one now. Fix several + hyphen-used-as-minus-sign in the new manpage. Add lintian overrides as + it still thinks there are hyphens used as minus sign but there are not. + * Fix bw-header being printed each time. + * The following bugs are also fixed now: (closes: #356448, #400662, #353037) + + -- Roberto Lumbreras Thu, 08 May 2008 00:45:51 +0200 + +iperf (2.0.2-4) unstable; urgency=low + + * Reverted patch to fix bug #431366; added proper patch for performance + problem with kernels using CFS (>= 2.6.23) (closes: #444277). + * debian/rules: using simple-patchsys from cdbs. + * Standards 3.7.3 (no changes). + * doc-base: changed section to Network/Monitoring section. + + -- Roberto Lumbreras Tue, 18 Mar 2008 09:12:52 +0100 + +iperf (2.0.2-3) unstable; urgency=low + + * Added patch to fix poor performance with >= 2.6.21 kernels + (closes: #431666). + * Fix -t: cast to max_size_t instead of int (closes: #346099). + Updated auto-makefiles and autoconf. + * debian/rules: now using cdbs. + + -- Roberto Lumbreras Tue, 17 Jul 2007 15:16:00 +0200 + +iperf (2.0.2-2) unstable; urgency=low + + * Add PTHREAD_LIBS to iperf_LDADD and regenerate configure, hopefully + will fix #314383: FTBFS on hurd-i386. + * Updated standards (no changes). + + -- Roberto Lumbreras Fri, 12 May 2006 16:49:36 +0200 + +iperf (2.0.2-1) unstable; urgency=low + + * New upstream version (closes: #312300). + + -- Roberto Lumbreras Tue, 07 Jun 2005 16:42:55 +0200 + +iperf (2.0.1-1) unstable; urgency=low + + * New upstream version. + * Added watch file. + * Updated standards. + + -- Roberto Lumbreras Fri, 04 Feb 2005 02:38:36 +0100 + +iperf (1.7.0-1) unstable; urgency=low + + * New upstream version. + * Use config.sub and config.guess symlinks from autotools-dev + (closes: #190015, #189673). + * Changed short description (closes: #188476). + + -- Roberto Lumbreras Tue, 22 Apr 2003 01:48:12 +0200 + +iperf (1.6.5-1) unstable; urgency=low + + * Initial Release (closes: #186418). + * Do not include getopt functions in libdast (they are provided by libc6). + * Send --help and --version outputs to stdout and exit success, to make + help2man happy (GNU standards, see bug #138752). + + -- Roberto Lumbreras Fri, 28 Mar 2003 19:07:09 +0100 + --- iperf-2.0.4.orig/debian/compat +++ iperf-2.0.4/debian/compat @@ -0,0 +1 @@ +7 --- iperf-2.0.4.orig/debian/doit.copyright +++ iperf-2.0.4/debian/doit.copyright @@ -0,0 +1,14 @@ +#!/bin/bash + +echo -n > debian/copyright + +cat << END_OF_FILE >> debian/copyright +This package was debianized by Roberto Lumbreras on +Thu, 27 Mar 2003 22:50:46 +0100. + +It was downloaded from https://sourceforge.net/projects/iperf/ + +Copyright: +END_OF_FILE + +lynx -dump doc/ui_license.html >> debian/copyright --- iperf-2.0.4.orig/debian/iperf.manpages +++ iperf-2.0.4/debian/iperf.manpages @@ -0,0 +1 @@ +man/iperf.1 --- iperf-2.0.4.orig/debian/copyright +++ iperf-2.0.4/debian/copyright @@ -0,0 +1,70 @@ +This package was debianized by Roberto Lumbreras on +Thu, 27 Mar 2003 22:50:46 +0100. + +It was downloaded from https://sourceforge.net/projects/iperf/ + +Copyright: + + Distributed Applications Support Team + + Iperf Copyright + _________________________________________________________________ + + Copyright (c) 1999,2000,2001,2002,2003,2004,2005 The Board of Trustees + of the University of Illinois + All Rights Reserved. + + [1]Iperf performance test + Mark Gates + Ajay Tirumala + Jim Ferguson + Jon Dugan + Feng Qin + Kevin Gibbs + John Estabrook + National Laboratory for Applied Network Research + National Center for Supercomputing Applications + University of Illinois at Urbana-Champaign + [2]http://www.ncsa.uiuc.edu + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software (Iperf) and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimers. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimers in + the documentation and/or other materials provided with the + distribution. + * Neither the names of the University of Illinois, NCSA, nor the + names of its contributors may be used to endorse or promote + products derived from this Software without specific prior written + permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + _________________________________________________________________ + + [3]dast@nlanr.net Last modified: Jan 5, 2004 + [4]NLANR || [5]applications support || [6]engineering support || + [7]measurement and operations + +References + + 1. http://dast.nlanr.net/Projects/Iperf + 2. http://www.ncsa.uiuc.edu/ + 3. mailto:dast@nlanr.net + 4. http://www.nlanr.net/ + 5. http://dast.nlanr.net/ + 6. http://ncne.nlanr.net/ + 7. http://moat.nlanr.net/ --- iperf-2.0.4.orig/debian/iperf.dirs +++ iperf-2.0.4/debian/iperf.dirs @@ -0,0 +1 @@ +usr/bin --- iperf-2.0.4.orig/debian/iperf.docs +++ iperf-2.0.4/debian/iperf.docs @@ -0,0 +1 @@ +README --- iperf-2.0.4.orig/debian/patches/006-iperf-die-on-connect-fail.patch +++ iperf-2.0.4/debian/patches/006-iperf-die-on-connect-fail.patch @@ -0,0 +1,11 @@ +--- iperf-2.0.4/src/Client.cpp 2008-04-07 22:37:54.000000000 -0400 ++++ iperf-2.0.4-fixed/src/Client.cpp 2009-03-03 12:30:02.000000000 -0500 +@@ -403,7 +403,7 @@ + // connect socket + rc = connect( mSettings->mSock, (sockaddr*) &mSettings->peer, + SockAddr_get_sizeof_sockaddr( &mSettings->peer )); +- WARN_errno( rc == SOCKET_ERROR, "connect" ); ++ FAIL_errno( rc == SOCKET_ERROR, "connect", mSettings ); + + getsockname( mSettings->mSock, (sockaddr*) &mSettings->local, + &mSettings->size_local ); --- iperf-2.0.4.orig/debian/patches/001-cast-to-max_size_t-instead-of-int.patch +++ iperf-2.0.4/debian/patches/001-cast-to-max_size_t-instead-of-int.patch @@ -0,0 +1,11 @@ +--- iperf-2.0.4.orig/src/Settings.cpp.orig 2008-04-08 04:37:54.000000000 +0200 ++++ iperf-2.0.4/src/Settings.cpp 2008-05-07 17:41:03.923942801 +0200 +@@ -458,7 +458,7 @@ + case 't': // seconds to write for + // time mode (instead of amount mode) + setModeTime( mExtSettings ); +- mExtSettings->mAmount = (int) (atof( optarg ) * 100.0); ++ mExtSettings->mAmount = (max_size_t) (atof( optarg ) * 100.0); + break; + + case 'u': // UDP instead of TCP --- iperf-2.0.4.orig/debian/patches/005-iperf-die-on-bind-fail.patch +++ iperf-2.0.4/debian/patches/005-iperf-die-on-bind-fail.patch @@ -0,0 +1,11 @@ +--- iperf-2.0.4/src/Listener.cpp 2009-02-23 16:20:31.000000000 -0500 ++++ iperf-2.0.4-fixed/src/Listener.cpp 2009-02-23 16:20:40.000000000 -0500 +@@ -333,7 +333,7 @@ + #endif + { + rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local ); +- WARN_errno( rc == SOCKET_ERROR, "bind" ); ++ FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings ); + } + // listen for connections (TCP only). + // default backlog traditionally 5 --- iperf-2.0.4.orig/debian/patches/003-fix-hyphen-used-as-minus-sign.patch +++ iperf-2.0.4/debian/patches/003-fix-hyphen-used-as-minus-sign.patch @@ -0,0 +1,174 @@ +--- iperf-2.0.4.orig/man/iperf.1 2008-08-21 00:21:49.290527643 +0200 ++++ iperf-2.0.4/man/iperf.1 2008-08-21 00:35:17.850640445 +0200 +@@ -2,21 +2,21 @@ + .SH NAME + iperf \- perform network throughput tests + .SH SYNOPSIS +-.B iperf -s [ ++.B iperf \-s [ + .I options + .B ] + +-.B iperf -c ++.B iperf \-c + .I server + .B [ + .I options + .B ] + +-.B iperf -u -s [ ++.B iperf \-u \-s [ + .I options + .B ] + +-.B iperf -u -c ++.B iperf \-u \-c + .I server + .B [ + .I options +@@ -28,103 +28,103 @@ + traffic). + .SH "GENERAL OPTIONS" + .TP +-.BR -f ", " --format " " ++.BR \-f ", " \-\-format " " + [kmKM] format to report: Kbits, Mbits, KBytes, MBytes + .TP +-.BR -h ", " --help " " ++.BR \-h ", " \-\-help " " + print a help synopsis + .TP +-.BR -i ", " --interval " \fIn\fR" ++.BR \-i ", " \-\-interval " \fIn\fR" + pause \fIn\fR seconds between periodic bandwidth reports + .TP +-.BR -l ", " --len " \fIn\fR[KM]" ++.BR \-l ", " \-\-len " \fIn\fR[KM]" + set length read/write buffer to \fIn\fR (default 8 KB) + .TP +-.BR -m ", " --print_mss " " ++.BR \-m ", " \-\-print_mss " " + print TCP maximum segment size (MTU - TCP/IP header) + .TP +-.BR -o ", " --output " " ++.BR \-o ", " \-\-output " " + output the report or error message to this specified file + .TP +-.BR -p ", " --port " \fIn\fR" ++.BR \-p ", " \-\-port " \fIn\fR" + set server port to listen on/connect to to \fIn\fR (default 5001) + .TP +-.BR -u ", " --udp " " ++.BR \-u ", " \-\-udp " " + use UDP rather than TCP + .TP +-.BR -w ", " --window " \fIn\fR[KM]" ++.BR \-w ", " \-\-window " \fIn\fR[KM]" + TCP window size (socket buffer size) + .TP +-.BR -B ", " --bind " " ++.BR \-B ", " \-\-bind " " + bind to , an interface or multicast address + .TP +-.BR -C ", " --compatibility " " ++.BR \-C ", " \-\-compatibility " " + for use with older versions does not sent extra msgs + .TP +-.BR -M ", " --mss " \fIn\fR" ++.BR \-M ", " \-\-mss " \fIn\fR" + set TCP maximum segment size (MTU - 40 bytes) + .TP +-.BR -N ", " --nodelay " " ++.BR \-N ", " \-\-nodelay " " + set TCP no delay, disabling Nagle's Algorithm + .TP +-.BR -v ", " --version " " ++.BR \-v ", " \-\-version " " + print version information and quit + .TP +-.BR -V ", " --IPv6Version " " ++.BR \-V ", " \-\-IPv6Version " " + Set the domain to IPv6 + .TP +-.BR -x ", " --reportexclude " " ++.BR \-x ", " \-\-reportexclude " " + [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports + .TP +-.BR -y ", " --reportstyle " C|c" ++.BR \-y ", " \-\-reportstyle " C|c" + if set to C or c report results as CSV (comma separated values) + .SH "SERVER SPECIFIC OPTIONS" + .TP +-.BR -s ", " --server " " ++.BR \-s ", " \-\-server " " + run in server mode + .TP +-.BR -U ", " --single_udp " " ++.BR \-U ", " \-\-single_udp " " + run in single threaded UDP mode + .TP +-.BR -D ", " --daemon " " ++.BR \-D ", " \-\-daemon " " + run the server as a daemon + .SH "CLIENT SPECIFIC OPTIONS" + .TP +-.BR -b ", " --bandwidth " \fIn\fR[KM]" ++.BR \-b ", " \-\-bandwidth " \fIn\fR[KM]" + set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec). +-This setting requires UDP (-u). ++This setting requires UDP (\-u). + .TP +-.BR -c ", " --client " " ++.BR \-c ", " \-\-client " " + run in client mode, connecting to + .TP +-.BR -d ", " --dualtest " " ++.BR \-d ", " \-\-dualtest " " + Do a bidirectional test simultaneously + .TP +-.BR -n ", " --num " \fIn\fR[KM]" +-number of bytes to transmit (instead of -t) ++.BR \-n ", " \-\-num " \fIn\fR[KM]" ++number of bytes to transmit (instead of \-t) + .TP +-.BR -r ", " --tradeoff " " ++.BR \-r ", " \-\-tradeoff " " + Do a bidirectional test individually + .TP +-.BR -t ", " --time " \fIn\fR" ++.BR \-t ", " \-\-time " \fIn\fR" + time in seconds to transmit for (default 10 secs) + .TP +-.BR -F ", " --fileinput " " ++.BR \-F ", " \-\-fileinput " " + input the data to be transmitted from a file + .TP +-.BR -I ", " --stdin " " ++.BR \-I ", " \-\-stdin " " + input the data to be transmitted from stdin + .TP +-.BR -L ", " --listenport " \fIn\fR" ++.BR \-L ", " \-\-listenport " \fIn\fR" + port to recieve bidirectional tests back on + .TP +-.BR -P ", " --parallel " \fIn\fR" ++.BR \-P ", " \-\-parallel " \fIn\fR" + number of parallel client threads to run + .TP +-.BR -T ", " --ttl " \fIn\fR" ++.BR \-T ", " \-\-ttl " \fIn\fR" + time-to-live, for multicast (default 1) + .TP +-.BR -Z ", " --linux-congestion " " ++.BR \-Z ", " \-\-linux\-congestion " " + set TCP congestion control algorithm (Linux only) + .SH ENVIRONMENT + .TP +@@ -143,6 +143,6 @@ + Kevin Gibbs, + John Estabrook , + Andrew Gallatin , +-Stephen Hemminger ++Stephen Hemminger + .SH "SEE ALSO" + http://iperf.sourceforge.net/ --- iperf-2.0.4.orig/debian/patches/004-svn-r43.patch +++ iperf-2.0.4/debian/patches/004-svn-r43.patch @@ -0,0 +1,229 @@ +diff -urN 204orig/AUTHORS trunk/AUTHORS +--- 204orig/AUTHORS 2008-04-08 04:37:54.000000000 +0200 ++++ trunk/AUTHORS 2008-05-10 05:18:35.000000000 +0200 +@@ -28,3 +28,9 @@ + + Stephen Hemminger + * Linux congestion control selection and theading improvements ++ ++Nathan Jones ++ * patch for underflow when value specified in -n is not a multiple of -l ++ ++Gerrit Renker ++ * replace costly gettimeofday() with nanonsleep() +diff -urN 204orig/ChangeLog trunk/ChangeLog +--- 204orig/ChangeLog 2008-04-08 05:32:07.000000000 +0200 ++++ trunk/ChangeLog 2008-05-10 05:18:35.000000000 +0200 +@@ -1,3 +1,23 @@ ++2008-05-09 Gerrit Renker ++ ++* replace costly gettimeofday() with nanonsleep() See: ++https://sourceforge.net/tracker/index.php?func=detail&aid=1940009&group_id=128336&atid=711373 ++ ++2008-05-09 Jon Dugan ++ ++* change currLen to unsigned to squelch warning generated by Nathan's patch ++ ++2008-05-09 Nathan Jones ++ ++* prevent underflow when the amount of data to be transmitted (-n) is not a ++multiple of the buffer size (-l) Patch: ++https://sourceforge.net/tracker/index.php?func=detail&aid=1943432&group_id=128336&atid=711373 ++ ++2008-04-08 Jon Dugan ++ ++* print report headers only once ++* use appropriate report header for UDP tests ++ + 2008-04-07 Jon Dugan + + * Add man page to autoconf goo +diff -urN 204orig/compat/delay.cpp trunk/compat/delay.cpp +--- 204orig/compat/delay.cpp 2007-08-30 00:06:19.000000000 +0200 ++++ trunk/compat/delay.cpp 2008-05-10 05:18:35.000000000 +0200 +@@ -51,24 +51,26 @@ + * ------------------------------------------------------------------- */ + + #include "Timestamp.hpp" +- ++#include "util.h" + #include "delay.hpp" + + /* ------------------------------------------------------------------- +- * A micro-second delay function. This uses gettimeofday (underneith +- * the Timestamp) which has a resolution of upto microseconds. I've +- * found it's good to within about 10 usecs. +- * I used to do calibration, but iperf automatically adjusts itself +- * so that isn't necesary, and it causes some problems if the +- * calibration adjustment is larger than your sleep time. ++ * A micro-second delay function using POSIX nanosleep(). This allows a ++ * higher timing resolution (under Linux e.g. it uses hrtimers), does not ++ * affect any signals, and will use up remaining time when interrupted. + * ------------------------------------------------------------------- */ ++void delay_loop(unsigned long usec) ++{ ++ struct timespec requested, remaining; + +-void delay_loop( unsigned long usec ) { +- Timestamp end; +- end.add( usec * 1e-6 ); ++ requested.tv_sec = 0; ++ requested.tv_nsec = usec * 1000L; + +- Timestamp now; +- while ( now.before( end ) ) { +- now.setnow(); +- } ++ while (nanosleep(&requested, &remaining) == -1) ++ if (errno == EINTR) ++ requested = remaining; ++ else { ++ WARN_errno(1, "nanosleep"); ++ break; ++ } + } +diff -urN 204orig/include/Timestamp.hpp trunk/include/Timestamp.hpp +--- 204orig/include/Timestamp.hpp 2007-08-30 00:06:19.000000000 +0200 ++++ trunk/include/Timestamp.hpp 2008-05-10 05:18:35.000000000 +0200 +@@ -152,6 +152,16 @@ + } + + /* ------------------------------------------------------------------- ++ * Return the number of microseconds from now to last time of setting. ++ * ------------------------------------------------------------------- */ ++ long delta_usec(void) { ++ struct timeval previous = mTime; ++ ++ setnow(); ++ return subUsec(previous); ++ } ++ ++ /* ------------------------------------------------------------------- + * subtract the right timestamp from my timestamp. + * return the difference in seconds as a floating point. + * ------------------------------------------------------------------- */ +@@ -202,29 +212,22 @@ + /* ------------------------------------------------------------------- + * return true if my timestamp is before the right timestamp. + * ------------------------------------------------------------------- */ +- bool before( Timestamp right ) { +- return mTime.tv_sec < right.mTime.tv_sec || +- (mTime.tv_sec == right.mTime.tv_sec && +- mTime.tv_usec < right.mTime.tv_usec); +- } +- +- /* ------------------------------------------------------------------- +- * return true if my timestamp is before the right timestamp. +- * ------------------------------------------------------------------- */ + bool before( timeval right ) { + return mTime.tv_sec < right.tv_sec || + (mTime.tv_sec == right.tv_sec && + mTime.tv_usec < right.tv_usec); + } ++ bool before( Timestamp right ) { return before(right.mTime); } + + /* ------------------------------------------------------------------- + * return true if my timestamp is after the right timestamp. + * ------------------------------------------------------------------- */ +- bool after( Timestamp right ) { +- return mTime.tv_sec > right.mTime.tv_sec || +- (mTime.tv_sec == right.mTime.tv_sec && +- mTime.tv_usec > right.mTime.tv_usec); ++ bool after( timeval right ) { ++ return mTime.tv_sec > right.tv_sec || ++ (mTime.tv_sec == right.tv_sec && ++ mTime.tv_usec > right.tv_usec); + } ++ bool after( Timestamp right ) { return after(right.mTime); } + + /** + * This function returns the fraction of time elapsed after the beginning +diff -urN 204orig/include/version.h trunk/include/version.h +--- 204orig/include/version.h 2008-04-08 05:12:30.000000000 +0200 ++++ trunk/include/version.h 2008-04-09 02:15:31.000000000 +0200 +@@ -1,2 +1,2 @@ +-#define IPERF_VERSION "2.0.4" ++#define IPERF_VERSION "2.0.4+svnr43" + #define IPERF_VERSION_DATE "7 Apr 2008" +diff -urN 204orig/src/Client.cpp trunk/src/Client.cpp +--- 204orig/src/Client.cpp 2008-04-08 04:37:54.000000000 +0200 ++++ trunk/src/Client.cpp 2008-05-10 05:18:35.000000000 +0200 +@@ -116,7 +116,7 @@ + const int kBytes_to_Bits = 8; + + void Client::RunTCP( void ) { +- long currLen = 0; ++ unsigned long currLen = 0; + struct itimerval it; + max_size_t totLen = 0; + +@@ -170,7 +170,12 @@ + } + + if ( !mMode_Time ) { +- mSettings->mAmount -= currLen; ++ /* mAmount may be unsigned, so don't let it underflow! */ ++ if( mSettings->mAmount >= currLen ) { ++ mSettings->mAmount -= currLen; ++ } else { ++ mSettings->mAmount = 0; ++ } + } + + } while ( ! (sInterupted || +@@ -198,7 +203,7 @@ + + void Client::Run( void ) { + struct UDP_datagram* mBuf_UDP = (struct UDP_datagram*) mBuf; +- long currLen = 0; ++ unsigned long currLen = 0; + + int delay_target = 0; + int delay = 0; +@@ -310,7 +315,12 @@ + delay_loop( delay ); + } + if ( !mMode_Time ) { +- mSettings->mAmount -= currLen; ++ /* mAmount may be unsigned, so don't let it underflow! */ ++ if( mSettings->mAmount >= currLen ) { ++ mSettings->mAmount -= currLen; ++ } else { ++ mSettings->mAmount = 0; ++ } + } + + } while ( ! (sInterupted || +diff -urN 204orig/src/ReportDefault.c trunk/src/ReportDefault.c +--- 204orig/src/ReportDefault.c 2008-04-08 04:37:54.000000000 +0200 ++++ trunk/src/ReportDefault.c 2008-04-09 02:08:11.000000000 +0200 +@@ -67,6 +67,7 @@ + * Prints transfer reports in default style + */ + void reporter_printstats( Transfer_Info *stats ) { ++ static char header_printed = 0; + + byte_snprintf( buffer, sizeof(buffer)/2, (double) stats->TotalLen, + toupper( stats->mFormat)); +@@ -76,13 +77,19 @@ + + if ( stats->mUDP != (char)kMode_Server ) { + // TCP Reporting +- printf( report_bw_header); ++ if( !header_printed ) { ++ printf( report_bw_header); ++ header_printed = 1; ++ } + printf( report_bw_format, stats->transferID, + stats->startTime, stats->endTime, + buffer, &buffer[sizeof(buffer)/2] ); + } else { + // UDP Reporting +- printf( report_bw_jitter_loss_header); ++ if( !header_printed ) { ++ printf( report_bw_jitter_loss_header); ++ header_printed = 1; ++ } + printf( report_bw_jitter_loss_format, stats->transferID, + stats->startTime, stats->endTime, + buffer, &buffer[sizeof(buffer)/2], --- iperf-2.0.4.orig/debian/patches/000-Iperf_Fix-CPU-Usage.diff +++ iperf-2.0.4/debian/patches/000-Iperf_Fix-CPU-Usage.diff @@ -0,0 +1,164 @@ +[Thread]: Replace thread_rest() with condition variables + +This applies the patch by Ingo Molnar from + + http://marc.info/?l=linux-kernel&m=119088670113210&w=2 + +by reverting previous changes that coincided with changes made by this +patch. Other than that, the patch is the original from the above URL. + +Gerrit +--- + compat/Thread.c | 6 ------ + src/Reporter.c | 37 +++++++++---------------------------- + src/main.cpp | 2 ++ + 3 files changed, 11 insertions(+), 34 deletions(-) + +rover: changed two remaining thread_rest. + +--- a/compat/Thread.c ++++ b/compat/Thread.c +@@ -405,12 +405,6 @@ int thread_numuserthreads( void ) { + void thread_rest ( void ) { + #if defined( HAVE_THREAD ) + #if defined( HAVE_POSIX_THREAD ) +-#if defined( _POSIX_PRIORITY_SCHEDULING ) +- sched_yield(); +-#else +- usleep( 0 ); +-#endif +- + #else // Win32 + SwitchToThread( ); + #endif +--- a/src/Reporter.c ++++ b/src/Reporter.c +@@ -110,9 +110,8 @@ + + char buffer[64]; // Buffer for printing + ReportHeader *ReportRoot = NULL; +-int threadWait = 0; +-int threadSleeping = 0; + extern Condition ReportCond; ++extern Condition ReportDoneCond; + int reporter_process_report ( ReportHeader *report ); + void process_report ( ReportHeader *report ); + int reporter_handle_packet( ReportHeader *report ); +@@ -340,7 +339,7 @@ + // item + while ( index == 0 ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + agent->agentindex = 0; +@@ -348,11 +347,9 @@ + // Need to make sure that reporter is not about to be "lapped" + while ( index - 1 == agent->agentindex ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } +- if (threadSleeping) +- Condition_Signal( &ReportCond ); + + // Put the information there + memcpy( agent->data + agent->agentindex, packet, sizeof(ReportStruct) ); +@@ -382,9 +379,6 @@ + packet->packetLen = 0; + ReportPacket( agent, packet ); + packet->packetID = agent->report.cntDatagrams; +- if (threadSleeping) +- Condition_Signal( &ReportCond ); +- + } + } + +@@ -396,11 +390,8 @@ + void EndReport( ReportHeader *agent ) { + if ( agent != NULL ) { + int index = agent->reporterindex; +- if (threadSleeping) +- Condition_Signal( &ReportCond ); +- + while ( index != -1 ) { +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + agent->agentindex = -1; +@@ -421,7 +412,7 @@ + Transfer_Info *GetReport( ReportHeader *agent ) { + int index = agent->reporterindex; + while ( index != -1 ) { +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + return &agent->report.info; +@@ -467,10 +458,6 @@ + * Update the ReportRoot to include this report. + */ + Condition_Lock( ReportCond ); +- if ( isUDP(agent) ) +- threadWait = 0; +- else +- threadWait = 1; + reporthdr->next = ReportRoot; + ReportRoot = reporthdr; + Condition_Signal( &ReportCond ); +@@ -567,6 +554,7 @@ + } + Condition_Unlock ( ReportCond ); + ++again: + if ( ReportRoot != NULL ) { + ReportHeader *temp = ReportRoot; + //Condition_Unlock ( ReportCond ); +@@ -589,19 +577,12 @@ + // finished with report so free it + free( temp ); + Condition_Unlock ( ReportCond ); ++ Condition_Signal( &ReportDoneCond ); ++ if (ReportRoot) ++ goto again; + } +- // yield control of CPU is another thread is waiting +- // sleep on a condition variable, as it is much cheaper +- // on most platforms than issuing schedyield or usleep +- // syscalls +- Condition_Lock ( ReportCond ); +- if ( threadWait && ReportRoot != NULL) { +- threadSleeping = 1; +- Condition_TimedWait (& ReportCond, 1 ); +- threadSleeping = 0; +- } +- Condition_Unlock ( ReportCond ); +- ++ Condition_Signal( &ReportDoneCond ); ++ usleep(10000); + } else { + //Condition_Unlock ( ReportCond ); + } +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -96,6 +96,7 @@ extern "C" { + // records being accessed in a report and also to + // serialize modification of the report list + Condition ReportCond; ++ Condition ReportDoneCond; + } + + // global variables only accessed within this file +@@ -142,6 +143,7 @@ int main( int argc, char **argv ) { + + // Initialize global mutexes and conditions + Condition_Initialize ( &ReportCond ); ++ Condition_Initialize ( &ReportDoneCond ); + Mutex_Initialize( &groupCond ); + Mutex_Initialize( &clients_mutex ); + + +