Commit 5e3cd93d authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add necessary goo for downloading, patching, building, installing the

emulab version of iperf.

Linux makefile stuff not working yet.
parent 1b096b80
......@@ -1880,6 +1880,7 @@ else
event/stated/waitForState \
event/stated/GNUmakefile event/stated/stated \
event/linktest/GNUmakefile \
event/linktest/iperf/GNUmakefile \
event/linktest/linktest.pl \
event/linktest/weblinktest event/linktest/linktest.proxy \
event/linktest/linktest_control \
......
......@@ -543,6 +543,7 @@ else
event/stated/waitForState \
event/stated/GNUmakefile event/stated/stated \
event/linktest/GNUmakefile \
event/linktest/iperf/GNUmakefile \
event/linktest/linktest.pl \
event/linktest/weblinktest event/linktest/linktest.proxy \
event/linktest/linktest_control \
......
......@@ -107,11 +107,12 @@ control-install: binaries
$(INSTALL_PROGRAM) $(SCRIPT_PROXY) $(INSTALL_BINDIR)
client: all
$(MAKE) --no-print-directory -C iperf
client-install: client
@if test ! -x '/usr/local/bin/rude' -o \
! -x '/usr/local/bin/crude' -o \
! -x '/usr/local/bin/pathrate_snd' -o \
! -x '/usr/local/bin/pathrate_rcv'; then \
! -x '/usr/local/bin/emulab-iperf'; then \
echo "**********************************************************"; \
echo "* *"; \
echo "* WARNING: Some tools needed by linktest were not found. *"; \
......@@ -120,8 +121,7 @@ client-install: client
echo "* *"; \
echo "* /usr/local/bin/rude *"; \
echo "* /usr/local/bin/crude *"; \
echo "* /usr/local/bin/pathrate_snd *"; \
echo "* /usr/local/bin/pathrate_rcv *"; \
echo "* /usr/local/bin/emulab-iperf *"; \
echo "* *"; \
echo "**********************************************************"; \
fi
......@@ -129,9 +129,8 @@ client-install: client
$(INSTALL_PROGRAM) $(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
lt-install:
$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
$(MAKE) --no-print-directory -C iperf client-install
clean:
rm -f *.o $(TESTS) $(SCRIPT) $(SCRIPT_RUN) weblinktest linktest_control
$(MAKE) --no-print-directory -C iperf clean
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../../..
SUBDIR = event/linktest/iperf
include $(OBJDIR)/Makeconf
all: src/emulab-iperf
include $(TESTBED_SRCDIR)/GNUmakerules
src/emulab-iperf: iperf-2.0.2 config.status build-iperf
build-iperf:
make $(MAKEFLAGS) -f Makefile
client-install:
make $(MAKEFLAGS) -f Makefile install
config.status:
$(SRCDIR)/iperf-2.0.2/configure
iperf-2.0.2:
$(SRCDIR)/iperf-fetch.sh $(SRCDIR)
clean:
make $(MAKEFLAGS) -f Makefile clean
#!/bin/sh
if [ -x /usr/bin/fetch ]; then
fetch=/usr/bin/fetch
elif [ -x /usr/bin/wget ]; then
fetch=/usr/bin/wget
else
echo "ERROR: iperf-fetch.sh: need either 'fetch' or 'wget' installed"
exit 1
fi
if [ ! -d iperf-2.0.2/src ]; then
echo "Downloading iperf source from www.emulab.net to $1 ..."
cd $1
$fetch http://www.emulab.net/downloads/iperf-2.0.2.tar.gz
if [ $? -ne 0 ]; then
echo "Failed..."
exit 1
fi
echo "Unpacking/patching iperf-2.0.2 source ..."
tar xzf iperf-2.0.2.tar.gz || {
echo "ERROR: iperf-fetch.sh: tar failed"
exit 1
}
cd iperf-2.0.2 && patch < ../iperf-patch || {
echo "ERROR: iperf-fetch.sh: patch failed"
exit 1
}
rm -f ../iperf-2.0.2.tar.gz */*.orig
fi
exit 0
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;
}
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