Commit 47501a1f authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Slightly modified version of iperf, as an emulab port. This program is

actually installed on the images, but this is a good place for it.
Same source configures and builds on Linux as is, so just need to copy
over the source dir to a linux machine and config/build/install.

If someone knows how to create an rpm out of it, that would be great!
parent 2c83f637
# New ports collection makefile for: iperf
# Date Created: 20 May 2001
# Whom: Pete Fritchman <petef@databits.net>
#
PORTNAME= iperf
PORTVERSION= 2.0.2
CATEGORIES= misc
MASTER_SITES= http://dast.nlanr.net/Projects/Iperf2.0/ \
${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
PKGNAMEPREFIX= emulab-
MAINTAINER= testbed-ops@flux.utah.edu
COMMENT= "The iperf distribution as configured for Emulab"
NO_CDROM= "can't charge a fee for the software"
HAS_CONFIGURE= yes
PLIST_FILES= bin/emulab-iperf
.include <bsd.port.pre.mk>
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --disable-ipv6
.include <bsd.port.post.mk>
MD5 (iperf-2.0.2.tar.gz) = bb658aba58a5af0356f5b1342dfe8f53
SIZE (iperf-2.0.2.tar.gz) = 233595
Index: include/headers.h
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/include/headers.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 headers.h
*** include/headers.h 24 Oct 2005 15:18:33 -0000 1.1.1.1
--- include/headers.h 24 Oct 2005 16:06:09 -0000
***************
*** 180,186 ****
--- 180,190 ----
// from the gnu archive
#include <iperf-int.h>
+ #ifdef __FreeBSD__
+ typedef uint64_t max_size_t;
+ #else
typedef uintmax_t max_size_t;
+ #endif
/* in case the OS doesn't have these, we provide our own implementations */
#include "gettimeofday.h"
Index: src/Client.cpp
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/Client.cpp,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Client.cpp
*** src/Client.cpp 24 Oct 2005 15:18:33 -0000 1.1.1.1
--- src/Client.cpp 24 Oct 2005 16:06:10 -0000
***************
*** 61,66 ****
--- 61,102 ----
#include "util.h"
#include "Locale.h"
+ static int flood_wait;
+ static int flood_delta;
+ static int flood_hysteresis;
+ static int flood_good;
+
+ void
+ pkt_wait_init(void)
+ {
+ flood_wait = 1;
+ flood_delta = 1;
+ flood_hysteresis = 1;
+ flood_good = 0;
+ }
+
+ void
+ pkt_wait(int err)
+ {
+ volatile int i;
+
+ if (err) {
+ flood_wait += flood_delta;
+ flood_good = 0;
+
+ //fprintf(stderr, "%d\n", flood_wait);
+ }
+ else {
+ if (++flood_good >= flood_hysteresis) {
+ flood_wait -= flood_delta;
+ flood_good = 0;
+ if (flood_wait = 0)
+ flood_wait = 1;
+ }
+ }
+ delay_loop( flood_wait );
+ }
+
/* -------------------------------------------------------------------
* Store server hostname, optionally local hostname, and socket info.
* ------------------------------------------------------------------- */
***************
*** 69,74 ****
--- 105,112 ----
mSettings = inSettings;
mBuf = NULL;
+ pkt_wait_init();
+
// initialize buffer
mBuf = new char[ mSettings->mBufLen ];
pattern( mBuf, mSettings->mBufLen );
***************
*** 213,236 ****
} else
canRead = true;
! // perform write
currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen );
if ( currLen < 0 ) {
! WARN_errno( currLen < 0, "write2" );
! break;
! }
! // report packets
! reportstruct->packetLen = currLen;
! ReportPacket( mSettings->reporthdr, reportstruct );
!
if ( delay > 0 ) {
delay_loop( delay );
}
! if ( !mMode_Time ) {
mSettings->mAmount -= currLen;
}
!
} while ( ! (sInterupted ||
(mMode_Time && mEndTime.before( reportstruct->packetTime )) ||
(!mMode_Time && 0 >= mSettings->mAmount)) && canRead );
--- 251,283 ----
} else
canRead = true;
! // perform write
! again:
currLen = write( mSettings->mSock, mBuf, mSettings->mBufLen );
if ( currLen < 0 ) {
! if (errno != ENOBUFS) {
! WARN_errno( currLen < 0, "write2" );
! break;
! }
! }
! if (currLen > 0) {
! // report packets
! reportstruct->packetLen = currLen;
! ReportPacket( mSettings->reporthdr, reportstruct );
! }
! pkt_wait((currLen < 0));
! if (currLen < 0)
! goto again;
! #if 0
if ( delay > 0 ) {
delay_loop( delay );
}
! #endif
! if ( !mMode_Time && currLen > 0 ) {
mSettings->mAmount -= currLen;
}
!
} while ( ! (sInterupted ||
(mMode_Time && mEndTime.before( reportstruct->packetTime )) ||
(!mMode_Time && 0 >= mSettings->mAmount)) && canRead );
Index: src/Makefile.in
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.in
*** src/Makefile.in 24 Oct 2005 15:18:33 -0000 1.1.1.1
--- src/Makefile.in 24 Oct 2005 16:06:10 -0000
***************
*** 38,44 ****
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
! bin_PROGRAMS = iperf$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
--- 38,44 ----
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
! bin_PROGRAMS = emulab-iperf$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
***************
*** 266,273 ****
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
! iperf$(EXEEXT): $(iperf_OBJECTS) $(iperf_DEPENDENCIES)
! @rm -f iperf$(EXEEXT)
$(CXXLINK) $(iperf_LDFLAGS) $(iperf_OBJECTS) $(iperf_LDADD) $(LIBS)
mostlyclean-compile:
--- 266,273 ----
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
! emulab-iperf$(EXEEXT): $(iperf_OBJECTS) $(iperf_DEPENDENCIES)
! @rm -f emulab-iperf$(EXEEXT)
$(CXXLINK) $(iperf_LDFLAGS) $(iperf_OBJECTS) $(iperf_LDADD) $(LIBS)
mostlyclean-compile:
Index: src/main.cpp
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/main.cpp,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 main.cpp
*** src/main.cpp 24 Oct 2005 15:18:34 -0000 1.1.1.1
--- src/main.cpp 24 Oct 2005 16:06:10 -0000
***************
*** 163,168 ****
--- 163,173 ----
// read settings from command-line parameters
Settings_ParseCommandLine( argc, argv, ext_gSettings );
+ // if needed, redirect the output into a specified file
+ if ( !isSTDOUT( ext_gSettings ) ) {
+ redirect( ext_gSettings->mOutputFileName );
+ }
+
// Check for either having specified client or server
if ( ext_gSettings->mThreadMode == kMode_Client
|| ext_gSettings->mThreadMode == kMode_Listener ) {
Index: src/stdio.c
===================================================================
RCS file: /usr/flux/CVS/emulab-iperf/src/stdio.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 stdio.c
*** src/stdio.c 24 Oct 2005 15:18:34 -0000 1.1.1.1
--- src/stdio.c 24 Oct 2005 16:06:10 -0000
***************
*** 255,262 ****
* ------------------------------------------------------------------- */
void redirect(const char *inOutputFileName) {
- #ifdef WIN32
-
FILE *fp;
if ( inOutputFileName == NULL ) {
--- 255,260 ----
***************
*** 264,277 ****
return;
}
! fp = freopen(inOutputFileName, "a+", stdout);
if ( fp == NULL ) {
fprintf(stderr, "redirect stdout failed!\n");
return;
}
-
- #endif
-
return;
}
--- 262,272 ----
return;
}
! fp = freopen(inOutputFileName, "a", stdout);
if ( fp == NULL ) {
fprintf(stderr, "redirect stdout failed!\n");
return;
}
return;
}
What is Iperf?
While tools to measure network performance, such as ttcp,
exist, most are very old and have confusing options. Iperf
was developed as a modern alternative for measuring TCP
and UDP bandwidth performance.
Iperf is a tool to measure maximum TCP bandwidth, allowing
the tuning of various parameters and UDP characteristics.
Iperf reports bandwidth, delay jitter, datagram loss.
WWW: http://dast.nlanr.net/Projects/Iperf/
Pete <petef@databits.net>
......@@ -7,7 +7,7 @@
PORTSDIR=/usr/ports
PORTSUBDIR=misc
SRCDIR=`dirname $0`
PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp"
PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp emulab-iperf"
for PORT in $PORTS
do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment