diff -bur -x configure iperf-2.0.4/AUTHORS iperf-2.0.5/AUTHORS --- iperf-2.0.4/AUTHORS 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/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 -bur -x configure iperf-2.0.4/ChangeLog iperf-2.0.5/ChangeLog --- iperf-2.0.4/ChangeLog 2008-04-08 05:32:07.000000000 +0200 +++ iperf-2.0.5/ChangeLog 2010-07-09 06:28:37.000000000 +0200 @@ -1,3 +1,52 @@ +2010-07-08 Jon Dugan + +* bumped default TCP send/recv buffer to 128K (this is not the kernel buffer +that controls the window, but rather the Iperf internal buffer) + +2010-04-10 Jon Dugan + +* update autoconf goo using Autoconf 2.65, this should help portability a bit + +2010-04-02 Ralf Lübben + +* honor -i flag when for a server (-s) when using TCP +* tracker issue 2836973 + +2010-04-01 Deny IP Any Any + +* Exit rather than warn on connection failure +* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518033 + +2010-03-31 Gerrit Renker + +* Gerrit Renker's version of Ingo's Molnar's patch to further reduce CPU usage +* tracker issue 2006708 + +2010-03-31 Gerrit Renker + +* "neater" output for some units, eg Kbps, Mbps, Gbps +* addresses some typos + +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 -bur -x configure iperf-2.0.4/Makefile.in iperf-2.0.5/Makefile.in --- iperf-2.0.4/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -41,9 +41,9 @@ config.guess config.sub depcomp install-sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -113,6 +113,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/aclocal.m4 iperf-2.0.5/aclocal.m4 --- iperf-2.0.4/aclocal.m4 2008-04-08 04:47:35.000000000 +0200 +++ iperf-2.0.5/aclocal.m4 2010-04-10 21:23:05.000000000 +0200 @@ -11,31 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -873,6 +848,3 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/acx_pthread.m4]) -m4_include([m4/ax_create_stdint_h.m4]) -m4_include([m4/dast.m4]) Only in iperf-2.0.5: autogen.sh diff -bur -x configure iperf-2.0.4/compat/Makefile.in iperf-2.0.5/compat/Makefile.in --- iperf-2.0.4/compat/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/compat/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -39,9 +39,9 @@ subdir = compat DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -114,6 +114,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/compat/Thread.c iperf-2.0.5/compat/Thread.c --- iperf-2.0.4/compat/Thread.c 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/compat/Thread.c 2010-03-31 01:08:24.000000000 +0200 @@ -405,12 +405,6 @@ 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 diff -bur -x configure iperf-2.0.4/compat/delay.cpp iperf-2.0.5/compat/delay.cpp --- iperf-2.0.4/compat/delay.cpp 2007-08-30 00:06:19.000000000 +0200 +++ iperf-2.0.5/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 -bur -x configure iperf-2.0.4/config.h.in iperf-2.0.5/config.h.in --- iperf-2.0.4/config.h.in 2008-04-08 04:48:30.000000000 +0200 +++ iperf-2.0.5/config.h.in 2010-04-10 21:23:05.000000000 +0200 @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Define if debugging info is desired */ #undef DBG_MJZ @@ -194,6 +197,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -246,9 +252,17 @@ /* Version number of package */ #undef VERSION -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* */ #undef _REENTRANT diff -bur -x configure iperf-2.0.4/configure.ac iperf-2.0.5/configure.ac --- iperf-2.0.4/configure.ac 2008-04-08 04:47:29.000000000 +0200 +++ iperf-2.0.5/configure.ac 2010-04-10 21:23:05.000000000 +0200 @@ -5,10 +5,14 @@ AC_PREREQ(2.59) -AC_INIT(Iperf,2.0.4) +AC_INIT(Iperf,2.0.5) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE() +m4_include([m4/ax_create_stdint_h.m4]) +m4_include([m4/dast.m4]) +m4_include([m4/acx_pthread.m4]) + AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [disable ipv6 support (default is autodetect)]), diff -bur -x configure iperf-2.0.4/doc/Makefile.in iperf-2.0.5/doc/Makefile.in --- iperf-2.0.4/doc/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/doc/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -38,9 +38,9 @@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -89,6 +89,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/include/Locale.h iperf-2.0.5/include/Locale.h --- iperf-2.0.4/include/Locale.h 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/include/Locale.h 2010-03-31 00:57:17.000000000 +0200 @@ -72,7 +72,7 @@ * settings * ------------------------------------------------------------------- */ -extern const char seperator_line[]; +extern const char separator_line[]; extern const char server_port[]; diff -bur -x configure iperf-2.0.4/include/Makefile.in iperf-2.0.5/include/Makefile.in --- iperf-2.0.4/include/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/include/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -38,9 +38,9 @@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -89,6 +89,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/include/Timestamp.hpp iperf-2.0.5/include/Timestamp.hpp --- iperf-2.0.4/include/Timestamp.hpp 2007-08-30 00:06:19.000000000 +0200 +++ iperf-2.0.5/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 -bur -x configure iperf-2.0.4/include/version.h iperf-2.0.5/include/version.h --- iperf-2.0.4/include/version.h 2008-04-08 05:12:30.000000000 +0200 +++ iperf-2.0.5/include/version.h 2010-07-09 06:28:37.000000000 +0200 @@ -1,2 +1,2 @@ -#define IPERF_VERSION "2.0.4" -#define IPERF_VERSION_DATE "7 Apr 2008" +#define IPERF_VERSION "2.0.5" +#define IPERF_VERSION_DATE "08 Jul 2010" diff -bur -x configure iperf-2.0.4/man/Makefile.in iperf-2.0.5/man/Makefile.in --- iperf-2.0.4/man/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/man/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -39,9 +39,9 @@ DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -94,6 +94,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/src/Client.cpp iperf-2.0.5/src/Client.cpp --- iperf-2.0.4/src/Client.cpp 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/Client.cpp 2010-04-01 22:23:17.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 ) { + /* 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 ) { + /* mAmount may be unsigned, so don't let it underflow! */ + if( mSettings->mAmount >= currLen ) { mSettings->mAmount -= currLen; + } else { + mSettings->mAmount = 0; + } } } while ( ! (sInterupted || @@ -403,7 +413,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 ); diff -bur -x configure iperf-2.0.4/src/Locale.c iperf-2.0.5/src/Locale.c --- iperf-2.0.4/src/Locale.c 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/Locale.c 2010-03-31 00:57:17.000000000 +0200 @@ -111,7 +111,7 @@ -t, --time # time in seconds to transmit for (default 10 secs)\n\ -F, --fileinput input the data to be transmitted from a file\n\ -I, --stdin input the data to be transmitted from stdin\n\ - -L, --listenport # port to recieve bidirectional tests back on\n\ + -L, --listenport # port to receive bidirectional tests back on\n\ -P, --parallel # number of parallel client threads to run\n\ -T, --ttl # time-to-live, for multicast (default 1)\n\ -Z, --linux-congestion set TCP congestion control algorithm (Linux only)\n\ @@ -146,7 +146,7 @@ * settings * ------------------------------------------------------------------- */ -const char seperator_line[] = +const char separator_line[] = "------------------------------------------------------------\n"; const char server_port[] = @@ -206,10 +206,10 @@ Datagrams\n"; const char report_bw_jitter_loss_format[] = -"[%3d] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n"; +"[%3d] %4.1f-%4.1f sec %ss %ss/sec %6.3f ms %4d/%5d (%.2g%%)\n"; const char report_sum_bw_jitter_loss_format[] = -"[SUM] %4.1f-%4.1f sec %ss %ss/sec %5.3f ms %4d/%5d (%.2g%%)\n"; +"[SUM] %4.1f-%4.1f sec %ss %ss/sec %6.3f ms %4d/%5d (%.2g%%)\n"; const char report_outoforder[] = "[%3d] %4.1f-%4.1f sec %d datagrams received out-of-order\n"; diff -bur -x configure iperf-2.0.4/src/Makefile.in iperf-2.0.5/src/Makefile.in --- iperf-2.0.4/src/Makefile.in 2008-04-08 05:38:40.000000000 +0200 +++ iperf-2.0.5/src/Makefile.in 2010-04-10 21:23:05.000000000 +0200 @@ -40,9 +40,9 @@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ - $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/dast.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/dast.m4 $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -118,6 +118,7 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ diff -bur -x configure iperf-2.0.4/src/ReportDefault.c iperf-2.0.5/src/ReportDefault.c --- iperf-2.0.4/src/ReportDefault.c 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/ReportDefault.c 2010-03-31 00:57:17.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 + 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 + 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], @@ -152,7 +159,7 @@ (data->mThreadMode == kMode_Listener ? 0 : 1) ); win_requested = data->mTCPWin; - printf( seperator_line ); + printf( separator_line ); if ( data->mThreadMode == kMode_Listener ) { printf( server_port, (isUDP( data ) ? "UDP" : "TCP"), @@ -191,7 +198,7 @@ printf( warn_window_requested, buffer ); } printf( "\n" ); - printf( seperator_line ); + printf( separator_line ); } /* diff -bur -x configure iperf-2.0.4/src/Reporter.c iperf-2.0.5/src/Reporter.c --- iperf-2.0.4/src/Reporter.c 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/Reporter.c 2010-03-31 01:08:24.000000000 +0200 @@ -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,9 +390,6 @@ void EndReport( ReportHeader *agent ) { if ( agent != NULL ) { int index = agent->reporterindex; - if (threadSleeping) - Condition_Signal( &ReportCond ); - while ( index != -1 ) { thread_rest(); index = agent->reporterindex; @@ -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 ); } diff -bur -x configure iperf-2.0.4/src/Server.cpp iperf-2.0.5/src/Server.cpp --- iperf-2.0.4/src/Server.cpp 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/Server.cpp 2010-04-03 03:24:40.000000000 +0200 @@ -92,7 +92,7 @@ } /* ------------------------------------------------------------------- - * Receieve data from the (connected) TCP/UDP socket. + * Receive data from the (connected) socket. * Sends termination flag several times at the end. * Does not close the socket. * ------------------------------------------------------------------- */ @@ -128,14 +128,27 @@ reportstruct->packetID = -reportstruct->packetID; currLen = -1; } - if ( isUDP (mSettings)) + + if ( isUDP (mSettings)) { + ReportPacket( mSettings->reporthdr, reportstruct ); + } else if ( !isUDP (mSettings) && mSettings->mInterval > 0) { + reportstruct->packetLen = currLen; + gettimeofday( &(reportstruct->packetTime), NULL ); ReportPacket( mSettings->reporthdr, reportstruct ); + } + + + } while ( currLen > 0 ); + // stop timing gettimeofday( &(reportstruct->packetTime), NULL ); + if ( !isUDP (mSettings)) { + if(0.0 == mSettings->mInterval) { reportstruct->packetLen = totLen; + } ReportPacket( mSettings->reporthdr, reportstruct ); } CloseReport( mSettings->reporthdr, reportstruct ); diff -bur -x configure iperf-2.0.4/src/Settings.cpp iperf-2.0.5/src/Settings.cpp --- iperf-2.0.4/src/Settings.cpp 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/Settings.cpp 2010-07-09 03:05:46.000000000 +0200 @@ -202,7 +202,7 @@ main->mFormat = 'a'; // -f, adaptive bits // skip help // -h, //main->mBufLenSet = false; // -l, - main->mBufLen = 8 * 1024; // -l, 8 Kbyte + main->mBufLen = 128 * 1024; // -l, 8 Kbyte //main->mInterval = 0; // -i, ie. no periodic bw reports //main->mPrintMSS = false; // -m, don't print MSS // mAmount is time also // -n, N/A diff -bur -x configure iperf-2.0.4/src/main.cpp iperf-2.0.5/src/main.cpp --- iperf-2.0.4/src/main.cpp 2008-04-08 04:37:54.000000000 +0200 +++ iperf-2.0.5/src/main.cpp 2010-03-31 01:08:24.000000000 +0200 @@ -96,6 +96,7 @@ // 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 @@ // Initialize global mutexes and conditions Condition_Initialize ( &ReportCond ); + Condition_Initialize ( &ReportDoneCond ); Mutex_Initialize( &groupCond ); Mutex_Initialize( &clients_mutex ); @@ -288,114 +290,6 @@ thread_destroy( ); } // end cleanup -#ifdef WIN32 -/*-------------------------------------------------------------------- - * ServiceStart - * - * each time starting the service, this is the entry point of the service. - * Start the service, certainly it is on server-mode - * - *-------------------------------------------------------------------- */ -VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv) { - - // report the status to the service control manager. - // - if ( !ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000) ) // wait hint - goto clean; - - thread_Settings* ext_gSettings = new thread_Settings; - - // Initialize settings to defaults - Settings_Initialize( ext_gSettings ); - // read settings from environment variables - Settings_ParseEnvironment( ext_gSettings ); - // read settings from command-line parameters - Settings_ParseCommandLine( dwArgc, lpszArgv, ext_gSettings ); - - // report the status to the service control manager. - // - if ( !ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000) ) // wait hint - goto clean; - - // if needed, redirect the output into a specified file - if ( !isSTDOUT( ext_gSettings ) ) { - redirect( ext_gSettings->mOutputFileName ); - } - - // report the status to the service control manager. - // - if ( !ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000) ) // wait hint - goto clean; - - // initialize client(s) - if ( ext_gSettings->mThreadMode == kMode_Client ) { - client_init( ext_gSettings ); - } - - // start up the reporter and client(s) or listener - { - thread_Settings *into = NULL; -#ifdef HAVE_THREAD - Settings_Copy( ext_gSettings, &into ); - into->mThreadMode = kMode_Reporter; - into->runNow = ext_gSettings; -#else - into = ext_gSettings; -#endif - thread_start( into ); - } - - // report the status to the service control manager. - // - if ( !ReportStatusToSCMgr( - SERVICE_RUNNING, // service state - NO_ERROR, // exit code - 0) ) // wait hint - goto clean; - - clean: - // wait for other (client, server) threads to complete - thread_joinall(); -} - - -// -// FUNCTION: ServiceStop -// -// PURPOSE: Stops the service -// -// PARAMETERS: -// none -// -// RETURN VALUE: -// none -// -// COMMENTS: -// If a ServiceStop procedure is going to -// take longer than 3 seconds to execute, -// it should spawn a thread to execute the -// stop code, and return. Otherwise, the -// ServiceControlManager will believe that -// the service has stopped responding. -// -VOID ServiceStop() { -#ifdef HAVE_THREAD - Sig_Interupt( 1 ); -#else - sig_exit(1); -#endif -} - -#endif diff -bur -x configure iperf-2.0.4/src/service.c iperf-2.0.5/src/service.c --- iperf-2.0.4/src/service.c 2007-08-30 00:06:19.000000000 +0200 +++ iperf-2.0.5/src/service.c 2009-01-24 11:52:31.000000000 +0100 @@ -492,4 +492,110 @@ return lpszBuf; } +/*-------------------------------------------------------------------- + * ServiceStart + * + * each time starting the service, this is the entry point of the service. + * Start the service, certainly it is on server-mode + * + *-------------------------------------------------------------------- */ +VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv) { + + // report the status to the service control manager. + // + if ( !ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000) ) // wait hint + goto clean; + + thread_Settings* ext_gSettings = new thread_Settings; + + // Initialize settings to defaults + Settings_Initialize( ext_gSettings ); + // read settings from environment variables + Settings_ParseEnvironment( ext_gSettings ); + // read settings from command-line parameters + Settings_ParseCommandLine( dwArgc, lpszArgv, ext_gSettings ); + + // report the status to the service control manager. + // + if ( !ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000) ) // wait hint + goto clean; + + // if needed, redirect the output into a specified file + if ( !isSTDOUT( ext_gSettings ) ) { + redirect( ext_gSettings->mOutputFileName ); + } + + // report the status to the service control manager. + // + if ( !ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000) ) // wait hint + goto clean; + + // initialize client(s) + if ( ext_gSettings->mThreadMode == kMode_Client ) { + client_init( ext_gSettings ); + } + + // start up the reporter and client(s) or listener + { + thread_Settings *into = NULL; +#ifdef HAVE_THREAD + Settings_Copy( ext_gSettings, &into ); + into->mThreadMode = kMode_Reporter; + into->runNow = ext_gSettings; +#else + into = ext_gSettings; +#endif + thread_start( into ); + } + + // report the status to the service control manager. + // + if ( !ReportStatusToSCMgr( + SERVICE_RUNNING, // service state + NO_ERROR, // exit code + 0) ) // wait hint + goto clean; + + clean: + // wait for other (client, server) threads to complete + thread_joinall(); +} + + +// +// FUNCTION: ServiceStop +// +// PURPOSE: Stops the service +// +// PARAMETERS: +// none +// +// RETURN VALUE: +// none +// +// COMMENTS: +// If a ServiceStop procedure is going to +// take longer than 3 seconds to execute, +// it should spawn a thread to execute the +// stop code, and return. Otherwise, the +// ServiceControlManager will believe that +// the service has stopped responding. +// +VOID ServiceStop() { +#ifdef HAVE_THREAD + Sig_Interupt( 1 ); +#else + sig_exit(1); +#endif +} + #endif diff -bur -x configure iperf-2.0.4/src/stdio.c iperf-2.0.5/src/stdio.c --- iperf-2.0.4/src/stdio.c 2007-08-30 00:06:19.000000000 +0200 +++ iperf-2.0.5/src/stdio.c 2010-03-31 00:57:17.000000000 +0200 @@ -238,7 +238,7 @@ } else if ( inNum < 99.95 ) { /* 99.95 would be rounded to 100 */ format = "%4.1f %s"; /* ##.# */ } else if ( inNum < 999.5 ) { /* 999.5 would be rounded to 1000 */ - format = " %4.0f %s"; /* ### */ + format = "%4.0f %s"; /* ### */ } else { /* 1000-1024 fits in 4 places * If not using Adaptive sizes then * this code will not control spaces*/