Initial checkin so I can regress to the original sources in case I do something really stupid!

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6448 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
stmansfield 2004-01-31 22:32:26 +00:00
parent c37ac501f3
commit 31647a1839
39 changed files with 67367 additions and 0 deletions

View File

@ -0,0 +1,104 @@
This file is here for people to list their contributions to the
netperf benchmark. When you enhance or fix something, put your name
and a description of the what/where/whey/why/how here. If you like,
feel free to include an email address.
I would like to apologize in advance to anyone I've forgotten to
include.
Rick Jones <raj@cup.hp.com>
Responsible for initial packaging and release of netperf and
"editorial" continuity for subsequent releases.
Karen Choy
Code to allow netserver to run as a standalone daemon.
Dave Shield <daves@csc.liv.ac.uk>
Wrote the first revision of the netperf and netserver manpages.
Sarr Blumson <sarr@citi.umich.edu>
Fixes for AIX 3.1 and 3.2. Also fixes for Solaris 2.1 without
realizing it ;-)
Jeff Smits <jgs@usl.com>
Fixes for TCP_RR and UDP_RR on sytems with an htonl that is not a no-op.
Warren Burnett <somewhere in Kansas>
Example code for DLPI tests.
Several Folks
Code to tell SunOS 4 to *not* restart system calls on receipt of a
signal.
Fore Systems Inc.
Manpages for the FORE API and question answering
David Channin
Access to systems running the Fore ATM API
Jonathan Stone <jonathan@DSG.Stanford.EDU>
Include file fixes for Ultrix
Bruce Barnett <barnett@grymoire.crd.ge.com>
Bunches of warnings fixes and lint picks for Solaris 2.3
Herman Dierks et al <dierks@austin.ibm.com>
Code to calculate confidence intervals for tests
Hal Murray <murray@pa.dec.com>
Helpful suggestions for the scripts to make them more compatible with
the netperf database (http://www.cup.hp.com/netperf/NetperfPage.html).
His prompting finally got me off my whatever to put the confidence
interval stuff from the guys at IBM into netperf
Peter Skopp pds@cs.columbia.edu
Fixes to make netperf more secure.
Tom Wilson <tcwilson@newbridge.com>
A fix to send_udp_rr to correct bogus throughput values.
Thorsten Lockert <tholo@tetherless.com>
A bunch of clean-up for the *BSD OSes
Serge Pachkovsky <ps@ocisgi7.unizh.ch>
Code for low-priority soaker process for AIX and SGI
The fine folks at Adaptec
The initial port of netperf (1.9PL4) to Windows NT 3.51.
Robin Callender <robin_callender@VNET.IBM.COM>
The PPC binaries for the 1.9PL4 port of netperf to NT and for assorted
code clean-ups and help with CPU utilization measurements.
"Todd J. Derr" <tjd@fore.com>
For offering to take-on support of the Fore ATM API files with 2.1 and
for his help in making the tar files and such more user-friendly
Michael Shuldman <michaels@inet.no>
Improvements to the makefile and additional checks for OpenBSD
Kris Corwin
discovery of a debug statement outside of if (debug) that may have
been the cause of all the nasty connection refused errors in random
UDP_RR tests...
Charles Harris
Initial prototype of the TCP_SENDFILE test support
Philip Pishioneri of Cornel
Conversion of the netperf.ps manul to PDF format.
The Hewlett-Packard OpenVMS folks
Assistance with the port to OpenVMS
Munechika SUMIKAWA @ KAME Project / FreeBSD.org
IPv6 fixes
Jan Iven of CERN
initial mods for sendfile() under Linux
Fabrice Bacchella
for pointing-out that Solaris 9 has a copy of Linux sendfile()
Andrew Gallatin
for assistance with the FreeBSD sysctl() stuff

View File

@ -0,0 +1,43 @@
Copyright (C) 1993 Hewlett-Packard Company
ALL RIGHTS RESERVED.
The enclosed software and documentation includes copyrighted works
of Hewlett-Packard Co. For as long as you comply with the following
limitations, you are hereby authorized to (i) use, reproduce, and
modify the software and documentation, and to (ii) distribute the
software and documentation, including modifications, for
non-commercial purposes only.
1. The enclosed software and documentation is made available at no
charge in order to advance the general development of
high-performance networking products.
2. You may not delete any copyright notices contained in the
software or documentation. All hard copies, and copies in
source code or object code form, of the software or
documentation (including modifications) must contain at least
one of the copyright notices.
3. The enclosed software and documentation has not been subjected
to testing and quality control and is not a Hewlett-Packard Co.
product. At a future time, Hewlett-Packard Co. may or may not
offer a version of the software and documentation as a product.
4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS".
HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE,
REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE A THIRD PARTY'S INTELLECTUAL
PROPERTY RIGHTS. HP DOES NOT WARRANT THAT THE SOFTWARE OR
DOCUMENTATION IS ERROR FREE. HP DISCLAIMS ALL WARRANTIES,
EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE
DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION,
MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION.

View File

@ -0,0 +1,37 @@
BE SURE TO READ THE MANUAL.
This is a brief readme file for the netperf TCP/UDP/sockets/etc
performance benchmark. This is here mostly as a boot-strap. The real
information is in the manual, which can be found in netperf.ps and
online from http://www.netperf.org/netperf/NetperfPage.html. The
sources, and a limited number of binaries, can be found from
ftp://ftp.cup.hp.com/dist/networking/benchmarks/netperf/ .
BE SURE TO READ THE MANUAL.
There is a COPYRIGHT file included. It is based on what the HP Legal
Eagles gave me. I am not sure if the legalese is clear, but the intent
is to say "Here is a benchmark. Use it in good health. Pass it along,
port it, enhance it. You didn't pay for this tool, so don't expect it
to be perfect ;-)" The rest of it is there to keep the layers happy...
Feel free to report results in public forums, but please be
excruciatingly complete in your description of the test envorinment.
Better still, report results to the netperf database at
http://www.netperf.org/netperf/NetperfPage.html.
There is an Internet mailing list devoted to netperf. It is called
netperf-talk and it is hosted on netperf.org. Subscription requests
should go to netperf-talk-request@netperf.org.
Please DO NOT SEND subscription requests to netperf-talk!
If you run into severe difficulties, or are just feeling chatty,
please feel free to drop some email to me - Rick Jones
<raj@cup.hp.com>. Be sure to include a meaningful subject lines.
happy benchmarking,
rick jones
BE SURE TO READ THE MANUAL.

View File

@ -0,0 +1,5 @@
This is NETPERF 2.2pl4 from www.netperf.org/netperf/NetperfPage.html, ported
to work with the yet-to-be named OpenBeOS project.
Cheers,
Scott Mansfield (thephantom@mac.com)

View File

@ -0,0 +1,66 @@
February 11, 2003
At the time of the initial port, I was not aware of a make facility
for OpenVMS. So, I would just compile and link the various files by
hand:
$ cc netperf.c
$ cc netlib.c
$ cc netsh.c
$ cc nettest_bsd.c
$ cc netserver.c
$ link/exe=netperf netperf.obj,netsh.obj,netlib.obj,nettest_bsd.obj
$ link/exe=netserver netserver.obj,netsh.obj,netlib.obj,nettest_bsd.obj
Installation for OpenVMS has a few differences from installation under
say Unix. There is no inetd for VMS - however, there is the concept
of an adding an auxilliary service that seems quite similar.
To configure netperf for operation as an auxilliary service, you will
need to edit/use the netserver_run.com file and alter the "path" to
netserver accordingly. The version that ships is setup for where Rick
Jones did his initial porting work and most likely is not apropriate
for you :)
$ define sys$output sys$sysroot:[netperf]hello_service.log
$ define sys$error sys$sysroot:[netperf]hello_service.log
$ run sys$sysroot:[netperf]netserver.exe
Then it will be necessary to "define" netperf (netserver) as an
auxilliary service. This will need to be customized as apropriate for
your system
$ tcpip set service netserver -
_$ /port=12865 -
_$ /protocol=tcp -
_$ /user=system -
_$ /limit=48 -
_$ /process_name=netserver -
_$ /file=sys$sysroot:[netperf]netserver_run.com
And then it is necessary to enable the service:
$ tcpip enable service netserver
If you want to disable the service, you can issue the command
$ tcpip set noservice netserver
By default, OpenVMS is case-insensitive with commandlines, and will
downshift everything to lower case. This does not interact well with
netperf's use of command-line options like "-H" and "-h" with rather
different meanings.
To workaround that, the following defines are believed to be
sufficient.
$ define DECC$ARGV_PARSE_STYLE ENABLE
$ define DECC$EFS_CASE_PRESERVE ENABLE
$ define DECC$POSIX_SEEK_STREAM_FILE ENABLE
$ define DECC$EFS_CHARSET ENABLE
$ set process /parse_style=extended
I do not know if this will be something one can also do for the
netserver - presumeably one could put these things in the
netserver_run.com file (guessing). At present though I've not tried
that, and I'm also not sure that netserver has any upper-case options.

View File

@ -0,0 +1,192 @@
These are the Release Notes for Revision 2.2pl4 of netperf:
Things changed in this release
*) USE_SYSCTL available on suitable FreeBSD releases to measure CPU
utilization without having to resort to -DUSE_LOOPER.
*) Include Solaris 9 with the Linux sendfile path under -DHAVE_SENDFILE
This still outstanding in this release
*) Knowing why signals are not interrupting socket calls under
OpenVMS. A quick try to use threads for timing a la Win32 worked,
but also cut performance in half. Any and all assistance in this
area would be most welcome.
These are the Release Notes for revisoin 2.2pl3 of netperf:
Things changed in this release
*) I started practicing what I preach and will set SO_REUSEADDR before
netserver tries to bind to its well-known port.
*) Initial port to OpenVMS. This includes support for the OVMS
Auxilliary server (inetd replacement). See README.ovms for more
details on what is involved in compiling and running netperf under
OpenVMS.
*) Testname comparisons are now case insensitive. This is a side
effect of OpenVMS downshifting commandlines to lowercase. I made
the change and decided it was OK to keep it that way, even though
for OpenVMS one _has_ to set the right defines to disable that
downshifting or the command-line options will not work. For example
"-H" will become "-h" which isn't quite the same thing...
*) Misc fixes for nettest_ipv6.c.
*) Support for sendfile() under Linux
Thins I would like to have changed but did not know how or didn't have
time:
*) Allow netserver to run as a standalone daemon under OpenVMS
*) Allow netserver to run as a standalone daemon under Windows
*) Rediscover an inetd-like facility for Windows
*) Figure-out how to get low-overhead, accurate, per-CPU utilization
figures under OpenVMS
*) Get the UDP_RR and UDP_STREAM tests to work under OpenVMS, and get
the TCP_RR test to work based on time rather than transaction
count. There is some bug (possibly in OpenVMS?) where the SIGALRM
fires, but a socket call will not return an EINTR.
Things that changed prior to this release:
*) Addition of the TCP_MAERTS test - this is a TCP_STREAM test where
the data flows from the netserver to the netperf rather than from
the netperf to the netserver. This can be useful in those
situations where netperf (netserver) is installed on a remote
system, but the tester has no shell access and wishes to get
performance data for the path from netserver to netperf.
These are the Release Notes for the 2.2 revision of netperf:
Things changed in this release
*) Various and sundry bugs fixed (in theory) for platforms such as
FreeBSD and Linux. If I left-out your bug fix, it was purely
accidental - my mind has a very small cache, and sometimes I will
"lose" email in the shuffle.
*) Initial support for sendfile() on HP-UX. This test will use the
sendfile() call instead of send() to send data to the
remote. Netperf "lies" to netserver and calls it a TCP_STREAM test
since what netserver needs to do is exactly the same. A future
patch may change that and simply have netserver call the same
routine for both test types. Kudos to Charles Harris for the
initial prototype.
*) The Fore ATM API and HiPPI tests have been dropped from the
distribution.
Things I would have liked to have changed, but did not have time for:
*) Conversion of the source and makefile to use the GNU configure/autoconf
utility to make it easier for folks to build by not having to edit
makefiles... You will notice that I have started to switch from
"DO_MUMBLE" to "HAVE_MUMBLE"
as always - happy benchmarking,
rick jones <raj@cup.hp.com>
---------------------------------------------------------------------
These are the Release Notes for the 2.1pl3 revision of netperf:
*) An OBOB (Off By One Bug) in netlib.c that was causing a core dump
on Irix should be fixed.
*) Irix systems should now be able to determine the number of CPU's
present automagically (code from outside, not tested yet because I
have no MP Irix systems at my disposal)
*) An alpha version of a TCP_CC test has been added - this is a
TCP_CRR test with out the "RR."
*) The -Ae has been removed from the default makefile. If someone has
a nice way to automagically generate the correct makefile for
different platforms I would like to learn how.
happy benchmarking,
rick jones <raj@cup.hp.com>
----------------------------------------------------------------------
These are the Release Notes for the 2.1 revision of netperf:
Things Changed in this release:
*) The XTI (Version 2 of the spec) tests are now documented in the
manual.
*) The TCP_CRR (Connect Request/Response) test is now documented in
the manual, including a description of how it mimics the behaviour
of http (the protocol underlying the WWW).
*) Support for for Windows NT 3.51 OS in the BSD Sockets tests (ok, so
they are really Winsock in that case :). Other test suites may be
ported as required/desired/appropriate.
*) Tests for TCP and UDP, using the IPv6 extensions to BSD sockets are
included in this release. They are included by adding -DUSE_IPv6 to
the makefile and recompiling.
*) Support for a "long long" datatype should only be required for
-DUSE_PSTAT compilation which is an HP-UX only thing. The
*unbundled* HP compilers from at least "HP92453-01 A.09.61 HP C
Compiler" and later should have the required support. The bundled
compiler may not. GCC should work - check the archives listed in
the comp.sys.hp.hpux FAQ for copies. The FAQ is archived on
rtfm.mit.edu under the path pub/usenet/comp.sys.hp.hpux.
*) A "proper" fix for double data type alignment has been included.
*) A new script is included with this release which can be used to
measure aggregate TCP_RR performance (multiple, concurrent
instances of the TCP_RR test). A related use of this script would
be measuring MP scaling. A single-byte TCP_RR test is good for this
purpose for two reasons:
1) it excercises the control/protocol paths heavily without
using much in the way of data copies which may be easier to
scale.
2) most systems can easily saturate cards with bandwidth, but
not so easily with request/response
Of course, feedback on this is most welcome.
*) When measuring CPU utilization, the units for service demand have
been changed from milliseconds (designated ms) of CPU per unit (KB
or Transaction) to microseconds (desginated us).
*) For accurate reporting of service demand, netperf needs to know the
number of CPU's present on a system. On some systems (HP-UX), this
is automatic. For others (All), it is necessary to add a global "-n
<numcpu>" option to both netperf and netserver.
!! IF THIS IS LEFT-OUT CPU UTILIZATION AND SERVICE DEMAND FOR !!
!! MULTI-PROCESSOR SYSTEMS WILL BE WRONG. !!
If you know of ways to programatically determine the number of
active CPUs on a system, please let the author Rick Jones
<raj@cup.hp.com> know.
*) other things I've probably forgotten :)
Things Not Changed in this release:
*) The ancillary test suites are essentially unchanged - DLPI,
HiPPI/LLA, Unix Domain, and Fore ATM API. Unless there is much
interest expressed in these tests, 2.1 may be the last release in
which they are included. The order of retirement would likely be
Unix Domain, HiPPI/LLA, Fore ATM API, and then DLPI.
Miscelaneous Comments:
*) The -DUSE_LOOPER CPU utilization _seems_ to be nice and low-impact
on HP-UX, Digital Unix, and IRIX. It does not yet seem to be
low-impact on Solaris (I need an example of priocntl usage), AIX
(setpri only works if you are root), and NT (not sure of the
reason). Help with those problems would be most appreciated.

View File

@ -0,0 +1,384 @@
#
# a script that can be used to measure aggregate netperf performance,
# original author is Mike Traynor. Modifications to create the
# "netperf TCP_ARR test" by rick jones
#
init_parms() {
TEST_TIME=60
NTEST=3
TOLERANCE=15
MAX_RETRIES=3
NETPERF="/usr/local/netperf/netperf"
NETPERF="./netperf"
NPROC_LIST=""
RR_SIZES=""
REM_HOST_LIST=""
DEVFILELIST=""
LLA=0
TCP=1
UDP=0
GPROF=0
}
set_default_parms() {
if [ "X$NPROC_LIST" = "X" ]
then
NPROC_LIST="1"
fi
if [ "X$REM_HOST_LIST" = "X" ]
then
REM_HOST_LIST="127.0.0.1"
fi
if [ "X$RR_SIZES" = "X" ]
then
RR_SIZES="1,1"
fi
NHOSTS=`echo $REM_HOST_LIST | awk '{printf "%d",NF}'`
GPROF_RUN_TIME=`expr $TEST_TIME - 20`
}
usage() {
more << @EOF
$*
USAGE: scale_script {test_options} {hostlist}
Measure maximum system network throughput.
The following are optional parameters:
-t nsec : Causes each test to be run for nsec seconds.
-gprof system : Take a gprof sample during the test. system
is the name of the kernel the system was booted
with.
-n "nproclist" : One series of tests is run for each space-separated
value in nproclist.
-r "sizelist" : One series of tests is run for each space-separated
request,reply pair in sizelist.
hostlist : A space separated list of hosts to test against.
+|-tcp : Run/Don't run TCP tests.
+|-udp : Run/Don't run UDP tests.
+|-lla : Run/Don't run LLA tests; this option also requires
the user to specify a list of network device files
using the -d option described below.
The following option must be provided when using the -lla option
described above:
-d "devfilelst" : Where devfilelst is a space-separated list
of network device file pairs. Each pair in
the list contains two device file names,
separated by a comma (eg. /dev/lan0,/dev/lan1),
where the device file on the left side of the
comma is for the local system and the device
file on the right side is for the remote system.
A device file pair must be specified for each
remote host which is specified.
Examples:
scale_script -n "8 16" -udp LGs37U1 LGs37U2 -r "1,1 100,100"
scale_script -t 1000 -n "16" -tcp -gprof /stand/vmunix LGs37U1 LGs37U2
scale_script -n 4 -lla -d /dev/lan0,/dev/lan0 /dev/lan1,/dev/lan0 \\
LGs37U1 LGs37U2
@EOF
}
check_usage() {
if [ `expr $TCP + $UDP + $LLA` -eq 0 ]
then
usage $0: ERROR: Must specify a test
exit
fi
if [ $LLA -eq 1 ]
then
NDEV=`echo $DEVFILELIST | awk '{printf "%d",NF}'`
if [ $NDEV -ne $NHOSTS ]
then
usage $0: ERROR: Number of device files does not match number of hosts
exit
fi
fi
for HOST in $REM_HOST_LIST
do
if [ `/etc/ping $HOST 100 1 | awk '/transmitted/{print $4}'`0 -ne 10 ]
then
usage $0: ERROR: Cannot ping host: $HOST
exit
fi
done
if [ $GPROF -eq 1 ]
then
if [ ! -r $GPROF_KERNEL ]
then
usage $0: ERROR: Cannot find system file: $GPROF_KERNEL
exit
fi
if [ $GPROF_RUN_TIME -le 800 ]
then
echo "\nWARNING: GPROF RUN TIME LESS THAN 800 SECONDS\n"
fi
fi
}
display_headstone() {
cat << @EOF
$TESTNAME Aggregate REQUEST/RESPONSE TEST to $REM_HOST_LIST
Local /Remote
Socket Size Request Resp. Elapsed Trans. Num.
Send Recv Size Size Time Rate Concurrent
bytes Bytes bytes bytes secs. per sec Netperfs
@EOF
}
display_test_banner() {
cat << @EOF
@EOF
}
build_sap_list() {
LSAP=4
SAPLIST=""
PROC=0
while [ $PROC -lt $NPROCS ]
do
PROC=`expr $PROC + 1`
LSAP=`expr $LSAP + 4`
RSAP=`expr $LSAP + 2`
SAPLIST="$SAPLIST $LSAP,$RSAP"
done
}
start_gprof() {
if [ $GPROF -eq 1 ]
then
( kgmon -h; kgmon -r; sleep 10; kgmon -b; sleep $GPROF_RUN_TIME; kgmon -h; kgmon -p $GPROF_KERNEL; mv gmon.out gmon.out.$TEST.$NPROCS )&
fi
}
start_1_proc_per_host() {
HOSTNUM=0
for HOST in $REM_HOST_LIST
do
if [ "$TEST" = "HIPPI_RR" ]
then
PROCNUM=`expr $PROCNUM + 1`
SAP=`echo $SAPLIST | awk "{print \\$$PROCNUM}"`
SAP="-s $SAP"
HOSTNUM=`expr $HOSTNUM + 1`
DEVFILE=`echo $DEVFILELIST | awk "{print \\$$HOSTNUM}"`
DEVFILE="-D $DEVFILE"
fi
$NETPERF -t $TEST -l $TEST_TIME -H $HOST -P0 -v0 -- \
$COW $DEVFILE $SAP $RR_SIZE $SEND_SIZE $SOCKET_SIZE &
done
}
start_n_procs_per_host() {
PROC=0
while [ $PROC -lt $1 ]
do
PROCNUM=`expr $PROC \* ${NHOSTS}`
start_1_proc_per_host &
PROC=`expr $PROC + 1`
done
wait
}
run_1_test() {
start_n_procs_per_host $PROCS_PER_HOST |\
awk 'BEGIN {max=0;min=99999;sum=0;n=0} \
{sum += $1;n++;ave=sum/n} \
$1<min {min=$1} \
$1>max {max=$1} \
{errl=(ave-min)/ave;errm=(max-ave)/ave;err=errl} \
errm>errl {err=errm} \
END {printf "Aggregate throughput: %2.2f TPS +/- %2.2f %%\n",sum,err*100}'
}
run_test_n_times() {
RETRY=0
TEST_COUNT=0
while [ $TEST_COUNT -lt $1 ]
do
TEST_COUNT=`expr $TEST_COUNT + 1`
start_gprof
run_1_test > .run_test_n_file
cat .run_test_n_file
ERROR_LVL=`awk '{print int($6+0.99)}' .run_test_n_file`
if [ $ERROR_LVL -gt $TOLERANCE ]
then
RETRY=`expr $RETRY + 1`
if [ $RETRY -le $MAX_RETRIES ]
then
TEST_COUNT=`expr $TEST_COUNT - 1`
TEST_TIME=`expr $TEST_TIME \* 2`
else
echo "!!!This is an INVALID RUN of the arr_script!!!" >&2
echo "!!!UNABLE to hit TOLERANCE of " $TOLERANCE "!!!" >&2
echo "Please select a longer initial time and try again." >&2
exit
fi
fi
done
}
do_req_rr_sizes() {
for S2 in $RR_SIZES
do
RR_SIZE="-r $S2"
display_test_banner $NPROCS $TEST $S2
run_test_n_times $NTEST > .do_series_file
TPS=`awk "int(\$6+0.99)<=$TOLERANCE {print}" .do_series_file |\
awk 'BEGIN {sum=0;n=1} \
sum>0 {n++} \
{sum+=$3} \
END {printf "%2.2f\n",(sum)/(n)}'`
SOCK_SEND=`echo $SOCKET_SIZE | awk '{print $2}'`
SOCK_RECV=`echo $SOCKET_SIZE | awk '{print $4}'`
REQ_SIZE=`echo $S2 | awk -F"," '{print $1}'`
RSP_SIZE=`echo $S2 | awk -F"," '{print $2}'`
echo $SOCK_SEND $SOCK_RECV $REQ_SIZE $RSP_SIZE $TEST_TIME $TPS $PROCS |\
awk '{printf "%5d %5d %5d %5d %5d %8.2f %5d",$1,$2,$3,$4,$5,$6,$7}'
done
}
tcp_test() {
#Run the TCP RR tests
TEST="TCP_RR"
SEND_SIZE=""
SOCKET_SIZE="-s 8192 -S 8192"
COW="-V"
do_req_rr_sizes
echo
}
udp_test() {
#Run the UDP RR tests
TEST="UDP_RR"
SEND_SIZE=""
SOCKET_SIZE="-s 9216 -S 9216"
COW="-V"
do_req_rr_sizes
echo
}
lla_test() {
#Run the UDP RR tests
TEST="HIPPI_RR"
SEND_SIZE=""
SOCKET_SIZE=""
COW=""
build_sap_list
do_req_rr_sizes
echo
}
do_req_procs() {
if [ $TCP -eq 1 ]
then
TESTNAME="TCP"
display_headstone
for PROCS in $NPROC_LIST
do
#Determine number of procs per host
PROCS_PER_HOST=`echo $PROCS $REM_HOST_LIST | awk '{printf "%d",($1+NF-2)/(NF-1)}'`
NPROCS=`expr $PROCS_PER_HOST \* $NHOSTS`
tcp_test
done
fi
if [ $UDP -eq 1 ]
then
TESTNAME="UDP"
display_headstone
for PROCS in $NPROC_LIST
do
#Determine number of procs per host
PROCS_PER_HOST=`echo $PROCS $REM_HOST_LIST | awk '{printf "%d",($1+NF-2)/(NF-1)}'`
NPROCS=`expr $PROCS_PER_HOST \* $NHOSTS`
udp_test
done
fi
if [ $LLA -eq 1 ]
then
TESTNAME="LLA"
display_headstone
for PROCS in $NPROC_LIST
do
#Determine number of procs per host
PROCS_PER_HOST=`echo $PROCS $REM_HOST_LIST | awk '{printf "%d",($1+NF-2)/(NF-1)}'`
NPROCS=`expr $PROCS_PER_HOST \* $NHOSTS`
lla_test
done
fi
}
######################################################################
init_parms
PARMS="${0##*/} ${@}"
# Parse the command line
while [ $# != 0 ]
do
case $1 in
\-gprof) GPROF=1
GPROF_KERNEL=$2
shift
;;
\-t) TEST_TIME=$2
shift
;;
\-n) NPROC_LIST="$NPROC_LIST $2"
shift
;;
\+lla) LLA=1
;;
\+tcp) TCP=1
;;
\+udp) UDP=1
;;
\-lla) LLA=0
;;
\-tcp) TCP=0
;;
\-udp) UDP=0
;;
\-d) DEVFILELIST="$DEVFILELIST $2"
shift
;;
\-r) RR_SIZES="$RR_SIZES $2"
shift
;;
\-*) usage $0: ERROR: Unexpected paramter: $1
exit
;;
*) REM_HOST_LIST="$REM_HOST_LIST $1"
;;
esac
shift
done
set_default_parms
check_usage
do_req_procs

View File

@ -0,0 +1,67 @@
/* hist.h
Given a time difference in microseconds, increment one of 61
different buckets:
0 - 9 in increments of 100 usecs
0 - 9 in increments of 1 msec
0 - 9 in increments of 10 msecs
0 - 9 in increments of 100 msecs
0 - 9 in increments of 1 sec
0 - 9 in increments of 10 sec
> 100 secs
This will allow any time to be recorded to within an accuracy of
10%, and provides a compact representation for capturing the
distribution of a large number of time differences (e.g.
request-response latencies).
Colin Low 10/6/93
*/
#ifndef _HIST_INCLUDED
#define _HIST_INCLUDED
#ifdef IRIX
#include <sys/time.h>
#endif /* IRIX */
struct histogram_struct {
int tenth_msec[10];
int unit_msec[10];
int ten_msec[10];
int hundred_msec[10];
int unit_sec[10];
int ten_sec[10];
int ridiculous;
int total;
};
typedef struct histogram_struct *HIST;
/*
HIST_new - return a new, cleared histogram data type
*/
HIST HIST_new(void);
/*
HIST_clear - reset a histogram by clearing all totals to zero
*/
void HIST_clear(HIST h);
/*
HIST_add - add a time difference to a histogram. Time should be in
microseconds.
*/
void HIST_add(register HIST h, int time_delta);
/*
HIST_report - create an ASCII report on the contents of a histogram.
Currently printsto standard out
*/
void HIST_report(HIST h);
#endif

View File

@ -0,0 +1,283 @@
#
# @(#)Makefile 2.1pl4 2003/03/04
#
# Makefile to build netperf benchmark tool
#
# for those folks running csh, this may help with makes
#SHELL="/bin/sh"
#what version of netperf is this for?
VERSION = 2.2pl4
#
# This tells the script where the executables and scripts are supposed
# to go. Some people might be used to "/usr/etc/net_perf", but
# for the rest of the world, it is probably better to put the binaries
# in /usr/local/netperf or /opt/netperf
#
#NETPERF_HOME = /usr/local/netperf
NETPERF_HOME = /opt/netperf
# The compiler on your system might be somewhere else, and/or have
# a different name.
#
# /bin/cc - the location on HP-UX 9.X and previous
# /usr/bin/cc - the location on HP-UX 10.0 and some other
# platforms (IRIX, OSF/1)
# /opt/SUNWspro/bin/cc - the unbundled C compiler under Solaris
# cc - if your paths are set, this may be all you
# need
# gcc - There is a gcc for MPE/iX
#
# one most systems, netperf spends very little time in user code, and
# most of its time in the kernel, so I *suspect* that different
# optimization levels won't make very much of a difference. however,
# might as well compile -O... If you are using the HP-UX unbundled
# compiler, this will generate a warning about an unsupported option.
# You may safely ignore that warning.
#
CC = cc
# Adding flags to CFLAGS enables some non-mainline features. For
# more information, please consult the source code.
# -Ae - enable ANSI C on HP-UX with namespace extensions. ANSI
# compilation is required for -DHISTOGRAM
# -DDIRTY - include code to dirty buffers before calls to send
# -DHISTOGRAM - include code to keep a histogram of r/r times or
# time spent in send() - requires -Ae on HP-UX
# This option requires -D_BSD_TYPES under IRIX
# -DINTERVALS - include code to allow pacing of sends in a UDP or TCP
# test. this may have unexpected results on non-HP-UX
# systems as I have not learned how to emulate the
# functionality found within the __hpux defines in
# the catcher() routine of netlib.c
# -DDO_DLPI - include code to test the DLPI implementation (may also
# require changes to LIBS. see below)
# -DDO_UNIX - include code to test Unix Domain sockets
# -D$(LOG_FILE) Specifies where netserver should put its debug output
# when debug is enabled
# -DUSE_LOOPER- use looper or soaker processes to measure CPU
# utilization. these will be forked-off at the
# beginning. if you are running this way, it is
# important to see how much impact these have on the
# measurement. A loopback test on uniprocessor should be
# able to consume ~100% of the CPU, and the difference
# between throughput with USE_LOOPER CPU and without
# should be small for a real network. if it is not, then
# some work proably needs to be done on reducing the
# priority of the looper processes.
# -DUSE_PSTAT - If used on HP-UX 10.0 and later, this will make CPU
# utilization measurements with some information
# returned byt he 10.X pstat() call. This is very
# accurate, and should have no impact on the
# measurement. Astute observers will notice that the
# LOC_CPU and REM_CPU rates with this method look
# remarkably close to the clockrate of the machine :)
# -DUSE_KSTAT - If used on Solaris 2.mumble, this will make CPU
# utilization measurements using the kstat interface.
# -DUSE_PROC_STAT - For use on linux systems with CPU utilization info in
# /proc/stat. Provides a fairly accurate CPU load measurement
# without affecting measurement.
# -DDO_IPV6 - Include tests which use a sockets interface to IPV6.
# The control connection remains IPV4
# -U__hpux - Use this when compiling _on_ HP-UX *for* an HP-RT system
#
# -DDO_DNS - Include tests (experimental) that measure the performance
# of a DNS server.
# -DHAVE_SENDFILE - Include the TCP_SENDFILE test to test the perf of
# sending data using sendfile() instead of send(). Depending
# on the platform, you may need to add a -lsendfile - see
# the comments about LIBS below
# -D_POSIX_SOURCE -D_SOCKET_SOURCE -DMPE - these are required for MPE/ix
#
# -DNEED_MAKEFILE_EDIT - this is the "cannary in the coal mine" to
# tell people that they need to edit the makefile for
# their platform. REMOVE THIS once you have edited
# the makefile for your platform
# -DUSE_SYSCTL - Use sysctl() on FreeBSD (perhaps other BSDs) to calculate
# CPU utilization
LOG_FILE=DEBUG_LOG_FILE="\"/tmp/netperf.debug\""
CFLAGS = -O -D$(LOG_FILE) -DNEED_MAKEFILE_EDIT
# Some platforms, and some options, require additional libraries.
# you can add to the "LIBS =" line to accomplish this. if you find
# that additional libs are required for your platform, please let
# me know. rick jones <raj@cup.hp.com>
# -lstr - required for -DDO_DLPI on HP-UX 9.X
# -lsocket -lnsl -lelf - required for Solaris 2.3 (2.4?)
# -L/usr/fore/lib -latm - required on all platforms for the Fore
# ATM API tests
# -lelf - on IRIX 5.2 to resolve nlist. with 2.0PL1
# and later, this should not be needed since
# netperf no longer uses nlist()
# -lsys5 - on Digital Unix (OSF) this helps insure that
# netserver processes are reaped?
# -lm - required for ALL platforms
# -lxti - required for -DDO_XTI on HP_UX 10.X
# -L/POSIXC60/lib -lunix -lm -lsocket - for MPE/iX
# -lkstat - required for -DUSE_KSTAT on Solaris
# -lsendfile - required for -DHAVE_SENDFILE on Solaris 9
LIBS= -lm
# ---------------------------------------------------------------
# it should not be the case that anything below this line needs to
# be changed. if it does, please let me know.
# rick jones <raj@cup.hp.com>
SHAR_SOURCE_FILES = netlib.c netlib.h netperf.c netserver.c \
netsh.c netsh.h \
nettest_bsd.c nettest_bsd.h \
nettest_dlpi.c nettest_dlpi.h \
nettest_unix.c nettest_unix.h \
nettest_xti.c nettest_xti.h \
nettest_ipv6.c nettest_ipv6.h \
nettest_dns.c nettest_dns.h \
hist.h \
makefile makefile.win32
ZIP_SOURCE_FILES = netlib.c netlib.h netperf.c netserver.c \
netsh.c netsh.h \
nettest_bsd.c nettest_bsd.h \
hist.h \
makefile.win32
SHAR_EXE_FILES = ACKNWLDGMNTS COPYRIGHT README Release_Notes \
netperf.ps \
netperf.man netserver.man \
README.ovms netserver_run.com
SHAR_SCRIPT_FILES = tcp_stream_script udp_stream_script \
tcp_rr_script udp_rr_script tcp_range_script \
snapshot_script arr_script packet_byte_script
NETSERVER_OBJS = netserver.o nettest_bsd.o nettest_dlpi.o \
nettest_unix.o netlib.o netsh.o \
nettest_xti.o nettest_ipv6.o \
nettest_dns.o
NETPERF_OBJS = netperf.o netsh.o netlib.o nettest_bsd.o \
nettest_dlpi.o nettest_unix.o \
nettest_xti.o nettest_ipv6.o \
nettest_dns.o
NETPERF_SCRIPTS = tcp_range_script tcp_stream_script tcp_rr_script \
udp_stream_script udp_rr_script \
snapshot_script
SCAF_FILES = spiff spiff.1 scaf_script scafsnapshot_script \
baselines/*
all: netperf netserver
netperf: $(NETPERF_OBJS)
$(CC) -o $@ $(NETPERF_OBJS) $(LIBS)
netserver: $(NETSERVER_OBJS)
$(CC) -o $@ $(NETSERVER_OBJS) $(LIBS)
netperf.o: netperf.c netsh.h makefile
netsh.o: netsh.c netsh.h nettest_bsd.h netlib.h makefile
netlib.o: netlib.c netlib.h netsh.h makefile
nettest_bsd.o: nettest_bsd.c nettest_bsd.h netlib.h netsh.h makefile
nettest_dlpi.o: nettest_dlpi.c nettest_dlpi.h netlib.h netsh.h makefile
nettest_unix.o: nettest_unix.c nettest_unix.h netlib.h netsh.h makefile
nettest_xti.o: nettest_xti.c nettest_xti.h netlib.h netsh.h makefile
nettest_ipv6.o: nettest_ipv6.c nettest_ipv6.h netlib.h netsh.h makefile
nettest_dns.o: nettest_dns.c nettest_dns.h netlib.h netsh.h makefile
netserver.o: netserver.c nettest_bsd.h netlib.h makefile
install: netperf netserver
mkdir -p $(NETPERF_HOME)
chmod -w *.[ch]
chmod +x $(NETPERF_SCRIPTS)
@if [ ! -d $(NETPERF_HOME) ]; then \
mkdir $(NETPERF_HOME) && chmod a+rx $(NETPERF_HOME); \
fi
cp netperf $(NETPERF_HOME)
cp netserver $(NETPERF_HOME)
cp $(NETPERF_SCRIPTS) $(NETPERF_HOME)
chmod a+rx $(NETPERF_HOME)/netperf $(NETPERF_HOME)/netserver
@for i in $(NETPERF_SCRIPTS); do \
chmod a+rx $(NETPERF_HOME)/$$i; \
done
clean:
rm -f *.o netperf netserver core
extraclean:
rm -f *.o netperf netserver core netperf.tar.gz netperf.shar \
netperf_src.shar
deinstall:
echo do this to deinstall rm -rf $(NETPERF_HOME)/*
netperf_src.shar: $(SHAR_SOURCE_FILES)
shar -bcCsZ $(SHAR_SOURCE_FILES) > netperf_src.shar
shar: netperf.shar
netperf.shar: netperf-$(VERSION).shar
netperf-$(VERSION).shar: ${SHAR_EXE_FILES} ${SHAR_SCRIPT_FILES} \
${SHAR_SOURCE_FILES}
rm -rf netperf-${VERSION} netperf-${VERSION}.shar
mkdir netperf-${VERSION}
cp ${SHAR_EXE_FILES} ${SHAR_SCRIPT_FILES} ${SHAR_SOURCE_FILES} \
netperf-${VERSION}
shar -cCsZv netperf-${VERSION} > netperf-${VERSION}.shar
netperf.zip: $(ZIP_SOURCE_FILES) $(SHAR_EXE_FILES)
zip netperf.zip $(ZIP_SOURCE_FILES) $(SHAR_EXE_FILES)
tar: netperf.tar.gz
netperf.tar: netperf-$(VERSION).tar
netperf.tar.gz: netperf-$(VERSION).tar.gz
netperf-$(VERSION).tar: ${SHAR_EXE_FILES} ${SHAR_SCRIPT_FILES} \
${SHAR_SOURCE_FILES}
rm -rf netperf-${VERSION} netperf-${VERSION}.tar
mkdir netperf-${VERSION}
cp ${SHAR_EXE_FILES} ${SHAR_SCRIPT_FILES} ${SHAR_SOURCE_FILES} \
netperf-${VERSION}
tar -cf netperf-${VERSION}.tar netperf-${VERSION}
netperf-$(VERSION).tar.gz: netperf-$(VERSION).tar
rm -f netperf-${VERSION}.tar.gz
gzip -9f netperf-${VERSION}.tar
netperf-scaf.tar: $(SHAR_EXE_FILES) \
$(SHAR_SCRIPT_FILES) \
$(SCAF_FILES)
tar -cf netperf-scaf.tar \
$(SHAR_EXE_FILES) \
$(SHAR_SCRIPT_FILES) $(SCAF_FILES)
compress netperf-scaf.tar
netperf-scaf.shar: $(SHAR_EXE_FILES) \
$(SHAR_SCRIPT_FILES) \
$(SCAF_FILES)
shar -bcCsZ $(SHAR_EXE_FILES) \
$(SHAR_SCRIPT_FILES) $(SCAF_FILES) > netperf-scaf.shar
#netperf.shar: $(SHAR_SOURCE_FILES) $(SHAR_EXE_FILES) $(SHAR_SCRIPT_FILES)
# shar -bcCsZ $(SHAR_SOURCE_FILES) $(SHAR_EXE_FILES) \
# $(SHAR_SCRIPT_FILES) > netperf.shar
#netperf.tar: $(SHAR_EXE_FILES) \
# $(SHAR_SCRIPT_FILES) $(SHAR_SOURCE_FILES)
# tar -cf netperf.tar $(SHAR_EXE_FILES) \
# $(SHAR_SCRIPT_FILES) $(SHAR_SOURCE_FILES)
# gzip netperf.tar

View File

@ -0,0 +1,69 @@
#
# @(#)Makefile 2.1alpha4 01/23/96
#
# Makefile to build netperf benchmark tool for Win32 (NT and 95 hopefully)
# based on work by Robin Callender
#
NETPERF_HOME = .\
# it should be OK to build a straight win32 application?
#!include <ntwin32.mak>
!include <win32.mak>
cflags = $(cflags)
# initial ports of netperf required -D_WINDOWS_NT_, but since the port
# has a decent chance of working on both NT and 95, and it seems that
# WIN32 is the common point, we rely on a WIN32 being defined, along
# with _CONSOLE_
DFLAGS = -D_CONSOLE_ -DDEBUG_LOG_FILE="\"netperf.log\"" -DUSE_LOOPER
#LIBS = wsock32.lib ntdll.lib
LIBS = wsock32.lib
#INCS = -Iy:\nt\public\sdk\inc -Iy:\nt\public\sdk\inc\crt
#DEPS = netlib.h makefile
DEPS = netlib.h
SHAR_SOURCE_FILES = netlib.c netlib.h netperf.c netserver.c \
netsh.c netsh.h \
nettest_bsd.c nettest_bsd.h \
makefile
NETPERF_OBJS = netperf.obj netsh.obj netlib.obj nettest_bsd.obj
NETSERVER_OBJS = netserver.obj nettest_bsd.obj netlib.obj netsh.obj
all: netperf.exe netserver.exe
netperf.exe: $(NETPERF_OBJS)
$(link) $(conflags) $(ldebug) $(conlibsmt) $(NETPERF_OBJS) \
$(LIBS) -out:$@
netserver.exe: $(NETSERVER_OBJS)
$(link) $(conflags) $(ldebug) $(conlibsmt) $(NETSERVER_OBJS) \
$(LIBS) -out:$@
netperf.obj: netperf.c netsh.h $(DEPS)
$(cc) $(cflags) $(DFLAGS) $(INCS) $(cvarsmt) netperf.c
netsh.obj: netsh.c netsh.h nettest_bsd.h $(DEPS)
$(cc) $(cflags) $(DFLAGS) $(INCS) $(cvarsmt) netsh.c
netlib.obj: netlib.c netsh.h $(DEPS)
$(cc) $(cflags) $(DFLAGS) $(INCS) $(cvarsmt) netlib.c
nettest_bsd.obj: nettest_bsd.c nettest_bsd.h netsh.h $(DEPS)
$(cc) $(cflags) $(DFLAGS) $(INCS) $(cvarsmt) nettest_bsd.c
netserver.obj: netserver.c nettest_bsd.h $(DEPS)
$(cc) $(cflags) $(DFLAGS) $(INCS) $(cvarsmt) netserver.c
clean:
del *.obj
del *.exe

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
/*
Copyright (C) 1993-2003 Hewlett-Packard Company
*/
#define PAD_TIME 4
/* library routine specifc defines */
#define MAXSPECDATA 62 /* how many ints worth of data */
/* can tests send... */
#define MAXTIMES 4 /* how many times may we loop */
/* to calibrate */
#define MAXCPUS 32 /* how many CPU's can we track */
#define MAXMESSAGESIZE 65536
#define MAXALIGNMENT 16384
#define MAXOFFSET 4096
#define DATABUFFERLEN MAXMESSAGESIZE+MAXALIGNMENT+MAXOFFSET
#define DEBUG_ON 1
#define DEBUG_OFF 2
#define DEBUG_OK 3
#define NODE_IDENTIFY 4
#define CPU_CALIBRATE 5
#define DO_TCP_STREAM 10
#define TCP_STREAM_RESPONSE 11
#define TCP_STREAM_RESULTS 12
#define DO_TCP_RR 13
#define TCP_RR_RESPONSE 14
#define TCP_RR_RESULTS 15
#define DO_UDP_STREAM 16
#define UDP_STREAM_RESPONSE 17
#define UDP_STREAM_RESULTS 18
#define DO_UDP_RR 19
#define UDP_RR_RESPONSE 20
#define UDP_RR_RESULTS 21
#define DO_DLPI_CO_STREAM 22
#define DLPI_CO_STREAM_RESPONSE 23
#define DLPI_CO_STREAM_RESULTS 24
#define DO_DLPI_CO_RR 25
#define DLPI_CO_RR_RESPONSE 26
#define DLPI_CO_RR_RESULTS 27
#define DO_DLPI_CL_STREAM 28
#define DLPI_CL_STREAM_RESPONSE 29
#define DLPI_CL_STREAM_RESULTS 30
#define DO_DLPI_CL_RR 31
#define DLPI_CL_RR_RESPONSE 32
#define DLPI_CL_RR_RESULTS 33
#define DO_TCP_CRR 34
#define TCP_CRR_RESPONSE 35
#define TCP_CRR_RESULTS 36
#define DO_STREAM_STREAM 37
#define STREAM_STREAM_RESPONSE 38
#define STREAM_STREAM_RESULTS 39
#define DO_STREAM_RR 40
#define STREAM_RR_RESPONSE 41
#define STREAM_RR_RESULTS 42
#define DO_DG_STREAM 43
#define DG_STREAM_RESPONSE 44
#define DG_STREAM_RESULTS 45
#define DO_DG_RR 46
#define DG_RR_RESPONSE 47
#define DG_RR_RESULTS 48
#define DO_FORE_STREAM 49
#define FORE_STREAM_RESPONSE 50
#define FORE_STREAM_RESULTS 51
#define DO_FORE_RR 52
#define FORE_RR_RESPONSE 53
#define FORE_RR_RESULTS 54
#define DO_HIPPI_STREAM 55
#define HIPPI_STREAM_RESPONSE 56
#define HIPPI_STREAM_RESULTS 57
#define DO_HIPPI_RR 52
#define HIPPI_RR_RESPONSE 53
#define HIPPI_RR_RESULTS 54
#define DO_XTI_TCP_STREAM 55
#define XTI_TCP_STREAM_RESPONSE 56
#define XTI_TCP_STREAM_RESULTS 57
#define DO_XTI_TCP_RR 58
#define XTI_TCP_RR_RESPONSE 59
#define XTI_TCP_RR_RESULTS 60
#define DO_XTI_UDP_STREAM 61
#define XTI_UDP_STREAM_RESPONSE 62
#define XTI_UDP_STREAM_RESULTS 63
#define DO_XTI_UDP_RR 64
#define XTI_UDP_RR_RESPONSE 65
#define XTI_UDP_RR_RESULTS 66
#define DO_XTI_TCP_CRR 67
#define XTI_TCP_CRR_RESPONSE 68
#define XTI_TCP_CRR_RESULTS 69
#define DO_TCP_TRR 70
#define TCP_TRR_RESPONSE 71
#define TCP_TRR_RESULTS 72
#define DO_TCP_NBRR 73
#define TCP_NBRR_RESPONSE 74
#define TCP_NBRR_RESULTS 75
#define DO_TCPIPV6_STREAM 76
#define TCPIPV6_STREAM_RESPONSE 77
#define TCPIPV6_STREAM_RESULTS 78
#define DO_TCPIPV6_RR 79
#define TCPIPV6_RR_RESPONSE 80
#define TCPIPV6_RR_RESULTS 81
#define DO_UDPIPV6_STREAM 82
#define UDPIPV6_STREAM_RESPONSE 83
#define UDPIPV6_STREAM_RESULTS 84
#define DO_UDPIPV6_RR 85
#define UDPIPV6_RR_RESPONSE 86
#define UDPIPV6_RR_RESULTS 87
#define DO_TCPIPV6_CRR 88
#define TCPIPV6_CRR_RESPONSE 89
#define TCPIPV6_CRR_RESULTS 90
#define DO_TCPIPV6_TRR 91
#define TCPIPV6_TRR_RESPONSE 92
#define TCPIPV6_TRR_RESULTS 93
#define DO_TCP_MAERTS 94
#define TCP_MAERTS_RESPONSE 95
#define TCP_MAERTS_RESULTS 96
#define DO_LWPSTR_STREAM 100
#define LWPSTR_STREAM_RESPONSE 110
#define LWPSTR_STREAM_RESULTS 120
#define DO_LWPSTR_RR 130
#define LWPSTR_RR_RESPONSE 140
#define LWPSTR_RR_RESULTS 150
#define DO_LWPDG_STREAM 160
#define LWPDG_STREAM_RESPONSE 170
#define LWPDG_STREAM_RESULTS 180
#define DO_LWPDG_RR 190
#define LWPDG_RR_RESPONSE 200
#define LWPDG_RR_RESULTS 210
#define DO_TCP_CC 300
#define TCP_CC_RESPONSE 301
#define TCP_CC_RESULTS 302
#define DO_DNS_RR 400
#define DNS_RR_RESPONSE 401
#define DNS_RR_RESULTS 402
/* some of the fields in these structures are going to be doubles and */
/* such. so, we probably want to ensure that they will start on */
/* "double" boundaries. this will break compatability to pre-2.1 */
/* releases, but then, backwards compatability has never been a */
/* stated goal of netperf. raj 11/95 */
union netperf_request_struct {
struct {
int request_type;
int dummy;
int test_specific_data[MAXSPECDATA];
} content;
double dummy;
};
union netperf_response_struct {
struct {
int response_type;
int serv_errno;
int test_specific_data[MAXSPECDATA];
} content;
double dummy;
};
struct ring_elt {
struct ring_elt *next; /* next element in the ring */
char *buffer_base; /* in case we have to free it at somepoint */
char *buffer_ptr; /* the aligned and offset pointer */
};
#ifdef HAVE_SENDFILE
struct sendfile_ring_elt {
struct sendfile_ring_elt *next; /* next element in the ring */
int fildes; /* the file descriptor of the source
file */
off_t offset; /* the offset from the beginning of
the file for this send */
size_t length; /* the number of bytes to send -
this is redundant with the
send_size variable but I decided
to include it anyway */
struct iovec *hdtrl; /* a pointer to a header/trailer
that we do not initially use and
so should be set to NULL when the
ring is setup. */
int flags; /* the flags to pass to sendfile() -
presently unused and should be
set to zero when the ring is
setup. */
};
#endif /* HAVE_SENDFILE */
/* the diferent codes to denote the type of CPU utilization */
/* methods used */
#define CPU_UNKNOWN 0
#define HP_IDLE_COUNTER 1
#define PSTAT 2
#define TIMES 3
#define LOOPER 4
#define GETRUSAGE 5
#define NT_METHOD 6
#define KSTAT 7
#define PROC_STAT 8
#define SYSCTL 9
#define BADCH ('?')
#ifndef NETLIB
#ifdef WIN32
#ifndef _GETOPT_
#define _GETOPT_
int getopt(int argc, char **argv, char *optstring);
extern char *optarg; /* returned arg to go with this option */
extern int optind; /* index to next argv element to process */
extern int opterr; /* should error messages be printed? */
extern int optopt; /* */
#endif /* _GETOPT_ */
extern int win_kludge_socket;
#endif /* WIN32 */
extern union netperf_request_struct netperf_request;
extern union netperf_response_struct netperf_response;
extern char libfmt;
extern int cpu_method;
extern int lib_num_loc_cpus;
extern int server_sock;
extern int times_up;
extern FILE *where;
extern int loops_per_msec;
extern float lib_local_per_cpu_util[];
extern void netlib_init();
extern void install_signal_catchers();
extern void establish_control();
extern void shutdown_control();
extern void init_stat();
extern void send_request();
extern void recv_response();
extern void send_response();
extern void recv_request();
extern void dump_request();
extern void start_timer();
extern void stop_timer();
extern void cpu_start();
extern void cpu_stop();
extern void calculate_confidence();
extern void retrieve_confident_values();
extern void display_confidence();
extern char *format_units();
extern double ntohd();
extern double htond();
extern void libmain();
extern double calc_thruput();
extern float calc_xfered();
extern float calibrate_local_cpu();
extern float calibrate_remote_cpu();
extern float calc_cpu_util();
extern float calc_service_demand();
#if defined(__hpux)
extern void catcher(int, siginfo_t *,void *);
#else
extern void catcher(int);
#endif /* __hpux */
extern struct ring_elt *allocate_buffer_ring();
#ifdef HAVE_SENDFILE
extern struct sendfile_ring_elt *alloc_sendfile_buf_ring();
#endif /* HAVE_SENDFILE */
extern int dl_connect();
extern int dl_bind();
extern int dl_open();
extern char format_cpu_method();
extern unsigned int convert();
/* these are all for the confidence interval stuff */
extern double confidence;
#endif
/* if your system has bcopy and bzero, include it here, otherwise, we */
/* will try to use memcpy aand memset. fix from Bruce Barnett @ GE. */
#if defined(hpux) || defined (__VMS)
#define HAVE_BCOPY
#define HAVE_BZERO
#endif
#ifndef HAVE_BCOPY
#define bcopy(s,d,h) memcpy((d),(s),(h))
#endif /* HAVE_BCOPY */
#ifndef HAVE_BZERO
#define bzero(p,h) memset((p),0,(h))
#endif /* HAVE_BZERO */
#ifndef HAVE_MIN
#define min(a,b) ((a < b) ? a : b)
#endif /* HAVE_MIN */

View File

@ -0,0 +1,269 @@
#ifdef NEED_MAKEFILE_EDIT
#error you must first edit and customize the makefile to your platform
#endif /* NEED_MAKEFILE_EDIT */
/*
Copyright (C) 1993-2001 Hewlett-Packard Company
ALL RIGHTS RESERVED.
The enclosed software and documention includes copyrighted works of
Hewlett-Packard Co. For as long as you comply with the following
limitations, you are hereby authorized to (i) use, reproduce, and
modify the software and documentation, and to (ii) distribute the
software and documentation, including modifications, for
non-commercial purposes only.
1. The enclosed software and documentation is made available at no
charge in order to advance the general development of
high-performance networking products.
2. You may not delete any copyright notices contained in the
software or documentation. All hard copies, and copies in
source code or object code form, of the software or
documentation (including modifications) must contain at least
one of the copyright notices.
3. The enclosed software and documentation has not been subjected
to testing and quality control and is not a Hewlett-Packard Co.
product. At a future time, Hewlett-Packard Co. may or may not
offer a version of the software and documentation as a product.
4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS".
HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE,
REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE A THIRD PARTY'S INTELLECTUAL
PROPERTY RIGHTS. HP DOES NOT WARRANT THAT THE SOFTWARE OR
DOCUMENTATION IS ERROR FREE. HP DISCLAIMS ALL WARRANTIES,
EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE
DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION,
MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION.
*/
char netperf_id[]="\
@(#)netperf.c (c) Copyright 1993-2003 Hewlett-Packard Company. Version 2.2pl3";
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <windows.h>
#include <winsock.h>
#endif /* WIN32 */
#include "netsh.h"
#include "netlib.h"
#include "nettest_bsd.h"
#ifdef DO_UNIX
#include "nettest_unix.h"
#endif /* DO_UNIX */
#ifdef DO_FORE
#include "nettest_fore.h"
#endif /* DO_FORE */
#ifdef DO_HIPPI
#include "nettest_hippi.h"
#endif /* DO_HIPPI */
#ifdef DO_XTI
#include "nettest_xti.h"
#endif /* DO_XTI */
#ifdef DO_DLPI
#include "nettest_dlpi.h"
#endif /* DO_DLPI */
#ifdef DO_IPV6
#include "nettest_ipv6.h"
#endif /* DO_IPV6 */
#ifdef DO_DNS
#include "nettest_dns.h"
#endif /* DO_DNS */
/* this file contains the main for the netperf program. all the other */
/* routines can be found in the file netsh.c */
int
main(argc,argv)
int argc;
char *argv[];
{
#ifdef WIN32
WSADATA wsa_data ;
/* Initialise the wsock lib ( version 1.1 ) */
if ( WSAStartup(0x0101,&wsa_data) == SOCKET_ERROR ){
printf("WSAStartup() fauled : %d\n",GetLastError()) ;
return 1 ;
}
#endif /* WIN32 */
netlib_init();
set_defaults();
scan_cmd_line(argc,argv);
if (debug) {
dump_globals();
install_signal_catchers();
}
if (debug) {
printf("remotehost is %s and port %d\n",host_name,test_port);
fflush(stdout);
}
establish_control(host_name,test_port);
if (strcasecmp(test_name,"TCP_STREAM") == 0) {
send_tcp_stream(host_name);
}
else if (strcasecmp(test_name,"TCP_MAERTS") == 0) {
send_tcp_maerts(host_name);
}
#ifdef HAVE_SENDFILE
else if (strcasecmp(test_name,"TCP_SENDFILE") == 0) {
sendfile_tcp_stream(host_name);
}
#endif /* HAVE_SENDFILE */
else if (strcasecmp(test_name,"TCP_RR") == 0) {
send_tcp_rr(host_name);
}
else if (strcasecmp(test_name,"TCP_CRR") == 0) {
send_tcp_conn_rr(host_name);
}
else if (strcasecmp(test_name,"TCP_CC") == 0) {
send_tcp_cc(host_name);
}
#ifdef DO_1644
else if (strcasecmp(test_name,"TCP_TRR") == 0) {
send_tcp_tran_rr(host_name);
}
#endif /* DO_1644 */
#ifdef DO_NBRR
else if (strcasecmp(test_name,"TCP_NBRR") == 0) {
send_tcp_nbrr(host_name);
}
#endif /* DO_NBRR */
else if (strcasecmp(test_name,"UDP_STREAM") == 0) {
send_udp_stream(host_name);
}
else if (strcasecmp(test_name,"UDP_RR") == 0) {
send_udp_rr(host_name);
}
else if (strcasecmp(test_name,"LOC_CPU") == 0) {
loc_cpu_rate();
}
else if (strcasecmp(test_name,"REM_CPU") == 0) {
rem_cpu_rate();
}
#ifdef DO_DLPI
else if (strcasecmp(test_name,"DLCO_RR") == 0) {
send_dlpi_co_rr();
}
else if (strcasecmp(test_name,"DLCL_RR") == 0) {
send_dlpi_cl_rr();
}
else if (strcasecmp(test_name,"DLCO_STREAM") == 0) {
send_dlpi_co_stream();
}
else if (strcasecmp(test_name,"DLCL_STREAM") == 0) {
send_dlpi_cl_stream();
}
#endif /* DO_DLPI */
#ifdef DO_UNIX
else if (strcasecmp(test_name,"STREAM_RR") == 0) {
send_stream_rr();
}
else if (strcasecmp(test_name,"DG_RR") == 0) {
send_dg_rr();
}
else if (strcasecmp(test_name,"STREAM_STREAM") == 0) {
send_stream_stream();
}
else if (strcasecmp(test_name,"DG_STREAM") == 0) {
send_dg_stream();
}
#endif /* DO_UNIX */
#ifdef DO_FORE
else if (strcasecmp(test_name,"FORE_STREAM") == 0) {
send_fore_stream(host_name);
}
else if (strcasecmp(test_name,"FORE_RR") == 0) {
send_fore_rr(host_name);
}
#endif /* DO_FORE */
#ifdef DO_HIPPI
else if (strcasecmp(test_name,"HIPPI_STREAM") == 0) {
send_hippi_stream(host_name);
}
else if (strcasecmp(test_name,"HIPPI_RR") == 0) {
send_hippi_rr(host_name);
}
#endif /* DO_HIPPI */
#ifdef DO_XTI
else if (strcasecmp(test_name,"XTI_TCP_STREAM") == 0) {
send_xti_tcp_stream(host_name);
}
else if (strcasecmp(test_name,"XTI_TCP_RR") == 0) {
send_xti_tcp_rr(host_name);
}
else if (strcasecmp(test_name,"XTI_UDP_STREAM") == 0) {
send_xti_udp_stream(host_name);
}
else if (strcasecmp(test_name,"XTI_UDP_RR") == 0) {
send_xti_udp_rr(host_name);
}
#endif /* DO_XTI */
#ifdef DO_LWP
else if (strcasecmp(test_name,"LWPSTR_STREAM") == 0) {
send_lwpstr_stream(host_name);
}
else if (strcasecmp(test_name,"LWPSTR_RR") == 0) {
send_lwpstr_rr(host_name);
}
else if (strcasecmp(test_name,"LWPDG_STREAM") == 0) {
send_lwpdg_stream(host_name);
}
else if (strcasecmp(test_name,"LWPDG_RR") == 0) {
send_lwpdg_rr(host_name);
}
#endif /* DO_LWP */
#ifdef DO_IPV6
else if (strcasecmp(test_name,"TCPIPV6_STREAM") == 0) {
send_tcpipv6_stream(host_name);
}
else if (strcasecmp(test_name,"TCPIPV6_RR") == 0) {
send_tcpipv6_rr(host_name);
}
else if (strcasecmp(test_name,"TCPIPV6_CRR") == 0) {
send_tcpipv6_rr(host_name);
}
else if (strcasecmp(test_name,"UDPIPV6_STREAM") == 0) {
send_udpipv6_stream(host_name);
}
else if (strcasecmp(test_name,"UDPIPV6_RR") == 0) {
send_udpipv6_rr(host_name);
}
#endif /* DO_IPV6 */
#ifdef DO_DNS
else if (strcasecmp(test_name,"DNS_RR") == 0) {
send_dns_rr(host_name);
}
#endif /* DO_DNS */
else {
printf("The test you requested is unknown to this netperf.\n");
printf("Please verify that you have the correct test name, \n");
printf("and that test family has been compiled into this netperf.\n");
exit(1);
}
shutdown_control();
return(0);
}

View File

@ -0,0 +1,165 @@
.TH netperf 1L ""
.SH NAME
netperf \- a network performance benchmark
.SH SYNOPSIS
.B netperf
[global options] -- [test specific options]
.SH DESCRIPTION
.B Netperf
is a benchmark that can be used to measure various aspects of
networking performance.
Currently, its focus is on bulk data transfer and request/response
performance using either TCP or UDP, and the Berkeley Sockets
interface. In addition, tests for DLPI, the Fore ATM API, Unix Domain
Sockets, and HP HiPPI LLA may be conditionally compiled-in.
.SS GLOBAL OPTIONS
.TP
.B \-a sizespec
Alter the send and receive buffer alignments on the local system.
This defaults to 8 bytes.
.TP
.B \-A sizespec
As -a, but for the remote system.
.TP
.B \-c [rate]
Request CPU utilization and service demand calculations for the
local system. If the optional rate parameter is specified,
.B netperf
will use that instead of calculating the rate itself.
.TP
.B \-C [rate]
As -c, but for the remote system.
.TP
.B \-d
Increase the quantity of debugging output displayed during
a test (possibly at the expense of performance).
.TP
.B \-f GMKgmk
Change the units of measure for stream tests. Capital letters are
powers of two, lowercase are powers of ten.
.TP
.B \-F fill_file
Pre-fill the send buffers with data from the named file. This is
intended to provide a means for avoiding buffers that are filled with
data which is trivially easy to compress. A good choice for a file
that should be present on any system is this manpage - netperf.man.
Other files may be provided as part of the distribution.
.TP
.B \-h
Display a usage string, and exit.
.TP
.B \-H remote_host
Set the hostname (or IP address) of the remote system.
.TP
.B \-i max,min
Set the maximum and minimum number of iterations when trying to reach
certain confidence levels.
.TP
.B \-I lvl,[,intvl]
Specify the confidence level (either 95 or 99 - 99 is the default) and
the width of the confidence interval as a percentage (default 10)
.TP
.B \-l testlen
Specify the length of the test (default 10 seconds).
A negative value sets the number of request/response transactions,
or the number of bytes for a stream test.
.TP
.B \-n numcpus
Specify the number of CPU's in the system on those systems for which
netperf has no way to find the number of CPU's programatically. (all
but HP-UX)
.TP
.B \-o sizespec
Set an offset from the alignment specified with -a.
.TP
.B \-O sizespec
As -o, but for the remote system.
.TP
.B \-p portnum
Connect to a
.C netsetver
listening on the specified port, rather than using /etc/services.
.TP
.B \-P 0|1
Show (1) or suppress (0) the test banner.
.TP
.B \-t testname
Specify the test to perform.
Valid testnames are (but not always compiled-in):
.RS
.RS
.nf
.I TCP_STREAM
.I TCP_RR
.I TCP_CRR
.I UDP_STREAM
.I UDP_RR
.I TCPIPV6_STREAM
.I TCPIPV6_RR
.I TCPIPV6_CRR
.I UDPIPV6_STREAM
.I UDPIPV6_RR
.I DLCO_STREAM
.I DLCO_RR
.I DLCL_STREAM
.I DLCL_RR
.I STREAM_STREAM
.I STREAM_RR
.I DG_STREAM
.I DG_RR
.I FORE_STREAM
.I FORE_RR
.I HIPPI_STREAM
.I HIPPI_RR
.I LOC_CPU
.I REM_CPU
.fi
.RE
.RE
.TP
.B \-v verbosity
Set the verbosity level for the test (only with -P).
.TP
.B \-V
Enable the copy-avoidance features (HP-UX 9.0 and later only).
.SS TEST SPECIFIC OPTIONS
.TP
.B \-h
Display a usage string based on the test name set with -t, and exit.
Please consult the netperf manual
.I
Netperf: A Network Performance Benchamrk
(netperf.ps) for more information.
.SH BUGS
There is a fairly large list of known defects and misfeatures in the
manual. If you think you have found a bug, please send email to Rick
Jones <raj@cup.hp.com>.
.SH SEE ALSO
.C netserver
.br
.I
Netperf: A Network Performance Benchmark
.br
http://www.cup.hp.com/netperf/NetperfPage.html
.SH AUTHORS
HP Information Networks Division - Networking Performance Team.
.br
Rick Jones <raj@cup.hp.com>
.br
Karen Choy HP IND
.br
Dave Shield <daves@csc.liv.ac.uk> (man pages)
.br
Others too numerous to mention here - see the ACKNWLDGMNTS file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,664 @@
#ifdef NEED_MAKEFILE_EDIT
#error you must first edit and customize the makefile to your platform
#endif /* NEED_MAKEFILE_EDIT */
/*
Copyright (C) 1993-2003 Hewlett-Packard Company
ALL RIGHTS RESERVED.
The enclosed software and documention includes copyrighted works of
Hewlett-Packard Co. For as long as you comply with the following
limitations, you are hereby authorized to (i) use, reproduce, and
modify the software and documentation, and to (ii) distribute the
software and documentation, including modifications, for
non-commercial purposes only.
1. The enclosed software and documentation is made available at no
charge in order to advance the general development of
high-performance networking products.
2. You may not delete any copyright notices contained in the
software or documentation. All hard copies, and copies in
source code or object code form, of the software or
documentation (including modifications) must contain at least
one of the copyright notices.
3. The enclosed software and documentation has not been subjected
to testing and quality control and is not a Hewlett-Packard Co.
product. At a future time, Hewlett-Packard Co. may or may not
offer a version of the software and documentation as a product.
4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS".
HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE,
REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE A THIRD PARTY'S INTELLECTUAL
PROPERTY RIGHTS. HP DOES NOT WARRANT THAT THE SOFTWARE OR
DOCUMENTATION IS ERROR FREE. HP DISCLAIMS ALL WARRANTIES,
EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE
DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY
DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION,
MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION.
*/
char netserver_id[]="\
@(#)netserver.c (c) Copyright 1993-2003 Hewlett-Packard Co. Version 2.2pl3";
/***********************************************************************/
/* */
/* netserver.c */
/* */
/* This is the server side code for the netperf test package. It */
/* will operate either stand-alone, or as a child of inetd. In this */
/* way, we insure that it can be installed on systems with or without */
/* root permissions (editing inetd.conf). Essentially, this code is */
/* the analog to the netsh.c code. */
/* */
/***********************************************************************/
/************************************************************************/
/* */
/* Global include files */
/* */
/************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#if !defined(WIN32) && !defined(__VMS)
#include <sys/ipc.h>
#endif /* !defined(WIN32) && !defined(__VMS) */
#include <fcntl.h>
#ifdef WIN32
#include <time.h>
#include <windows.h>
#include <winsock.h>
#else
#ifndef MPE
#include <sys/time.h>
#endif /* MPE */
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#ifndef DONT_WAIT
#include <sys/wait.h>
#endif /* DONT_WAIT */
#endif /* WIN32 */
#include <string.h>
#include <stdlib.h>
#ifdef __VMS
#include <tcpip$inetdef.h>
#include <unixio.h>
#endif /* __VMS */
#include "netlib.h"
#include "nettest_bsd.h"
#ifdef DO_UNIX
#include "nettest_unix.h"
#endif /* DO_UNIX */
#ifdef DO_DLPI
#include "nettest_dlpi.h"
#endif /* DO_DLPI */
#ifdef DO_IPV6
#include "nettest_ipv6.h"
#endif /* DO_IPV6 */
#ifdef DO_DNS
#include "nettest_dns.h"
#endif /* DO_DNS */
#include "netsh.h"
#ifndef DEBUG_LOG_FILE
#define DEBUG_LOG_FILE "/tmp/netperf.debug"
#endif /* DEBUG_LOG_FILE */
/* some global variables */
FILE *afp;
short listen_port_num;
extern char *optarg;
extern int optind, opterr;
#define SERVER_ARGS "dn:p:46"
/* This routine implements the "main event loop" of the netperf */
/* server code. Code above it will have set-up the control connection */
/* so it can just merrily go about its business, which is to */
/* "schedule" performance tests on the server. */
void
process_requests()
{
float temp_rate;
while (1) {
recv_request();
if (debug)
dump_request();
switch (netperf_request.content.request_type) {
case DEBUG_ON:
netperf_response.content.response_type = DEBUG_OK;
if (!debug)
debug++;
dump_request();
send_response();
break;
case DEBUG_OFF:
if (debug)
debug--;
netperf_response.content.response_type = DEBUG_OK;
fclose(where);
send_response();
break;
case CPU_CALIBRATE:
netperf_response.content.response_type = CPU_CALIBRATE;
temp_rate = calibrate_local_cpu(0.0);
bcopy((char *)&temp_rate,
(char *)netperf_response.content.test_specific_data,
sizeof(temp_rate));
if (debug) {
fprintf(where,"netserver: sending CPU information:");
fprintf(where,"rate is %g\n",temp_rate);
fflush(where);
}
/* we need the cpu_start, cpu_stop in the looper case to kill the */
/* child proceses raj 7/95 */
#ifdef USE_LOOPER
cpu_start(1);
cpu_stop(1,&temp_rate);
#endif /* USE_LOOPER */
send_response();
break;
case DO_TCP_STREAM:
recv_tcp_stream();
break;
case DO_TCP_MAERTS:
recv_tcp_maerts();
break;
case DO_TCP_RR:
recv_tcp_rr();
break;
case DO_TCP_CRR:
recv_tcp_conn_rr();
break;
case DO_TCP_CC:
recv_tcp_cc();
break;
#ifdef DO_1644
case DO_TCP_TRR:
recv_tcp_tran_rr();
break;
#endif /* DO_1644 */
#ifdef DO_NBRR
case DO_TCP_NBRR:
recv_tcp_nbrr();
break;
#endif /* DO_NBRR */
case DO_UDP_STREAM:
recv_udp_stream();
break;
case DO_UDP_RR:
recv_udp_rr();
break;
#ifdef DO_DLPI
case DO_DLPI_CO_RR:
recv_dlpi_co_rr();
break;
case DO_DLPI_CL_RR:
recv_dlpi_cl_rr();
break;
case DO_DLPI_CO_STREAM:
recv_dlpi_co_stream();
break;
case DO_DLPI_CL_STREAM:
recv_dlpi_cl_stream();
break;
#endif /* DO_DLPI */
#ifdef DO_UNIX
case DO_STREAM_STREAM:
recv_stream_stream();
break;
case DO_STREAM_RR:
recv_stream_rr();
break;
case DO_DG_STREAM:
recv_dg_stream();
break;
case DO_DG_RR:
recv_dg_rr();
break;
#endif /* DO_UNIX */
#ifdef DO_FORE
case DO_FORE_STREAM:
recv_fore_stream();
break;
case DO_FORE_RR:
recv_fore_rr();
break;
#endif /* DO_FORE */
#ifdef DO_HIPPI
case DO_HIPPI_STREAM:
recv_hippi_stream();
break;
case DO_HIPPI_RR:
recv_hippi_rr();
break;
#endif /* DO_HIPPI */
#ifdef DO_XTI
case DO_XTI_TCP_STREAM:
recv_xti_tcp_stream();
break;
case DO_XTI_TCP_RR:
recv_xti_tcp_rr();
break;
case DO_XTI_UDP_STREAM:
recv_xti_udp_stream();
break;
case DO_XTI_UDP_RR:
recv_xti_udp_rr();
break;
#endif /* DO_XTI */
#ifdef DO_LWP
case DO_LWPSTR_STREAM:
recv_lwpstr_stream();
break;
case DO_LWPSTR_RR:
recv_lwpstr_rr();
break;
case DO_LWPDG_STREAM:
recv_lwpdg_stream();
break;
case DO_LWPDG_RR:
recv_lwpdg_rr();
break;
#endif /* DO_LWP */
#ifdef DO_IPV6
case DO_TCPIPV6_STREAM:
recv_tcpipv6_stream();
break;
case DO_TCPIPV6_RR:
recv_tcpipv6_rr();
break;
case DO_TCPIPV6_CRR:
recv_tcpipv6_conn_rr();
break;
case DO_UDPIPV6_STREAM:
recv_udpipv6_stream();
break;
case DO_UDPIPV6_RR:
recv_udpipv6_rr();
break;
#endif /* DO_IPV6 */
#ifdef DO_DNS
case DO_DNS_RR:
recv_dns_rr();
break;
#endif /* DO_DNS */
default:
fprintf(where,"unknown test number %d\n",
netperf_request.content.request_type);
fflush(where);
netperf_response.content.serv_errno=998;
send_response();
break;
}
}
}
/*********************************************************************/
/* */
/* set_up_server() */
/* */
/* set-up the server listen socket. we only call this routine if the */
/* user has specified a port number on the command line. */
/* */
/*********************************************************************/
/*KC*/
void set_up_server(int af)
{
struct sockaddr *server;
struct sockaddr_in server4;
struct sockaddr peeraddr;
#ifdef DO_IPV6
struct sockaddr_in6 server6;
#endif
int server_control;
int sockaddr_len;
int on=1;
if (af == AF_INET) {
server4.sin_port = htons(listen_port_num);
server4.sin_addr.s_addr = INADDR_ANY;
server4.sin_family = AF_INET;
sockaddr_len = sizeof(struct sockaddr_in);
server = (struct sockaddr *) &server4;
}
#ifdef DO_IPV6
else {
server6.sin6_port = htons(listen_port_num);
server6.sin6_family = AF_INET6;
#ifndef IN6_CLEAR_IN6ADDR
#define IN6_CLEAR_IN6ADDR(x) memset(&(x), 0, sizeof(struct in6_addr))
#endif
IN6_CLEAR_IN6ADDR(server6.sin6_addr);
sockaddr_len = sizeof(struct sockaddr_in6);
server = (struct sockaddr *) &server6;
}
#else
else {
fprintf(stderr,
"netserver: IPv6 is not supported\n");
fflush(stderr);
exit(1);
}
#endif
printf("Starting netserver at port %d\n",listen_port_num);
server_control = socket(server->sa_family,SOCK_STREAM,0);
#ifdef WIN32
if (server_control == INVALID_SOCKET)
#else
if (server_control < 0)
#endif /* WIN32 */
{
perror("server_set_up: creating the socket");
exit(1);
}
if (setsockopt(server_control,
SOL_SOCKET,
SO_REUSEADDR,
&on ,
sizeof(on)) == -1)
{
perror("server_set_up: SO_REUSEADDR");
exit(1);
}
if (bind (server_control, server, sockaddr_len) == -1)
{
perror("server_set_up: binding the socket");
exit (1);
}
if (listen (server_control,5) == -1)
{
perror("server_set_up: listening");
exit(1);
}
/*
setpgrp();
*/
#if !defined(WIN32) && !defined(MPE) && !defined(__VMS)
switch (fork())
{
case -1:
perror("netperf server error");
exit(1);
case 0:
/* stdin/stderr should use fclose */
fclose(stdin);
fclose(stderr);
#ifndef NO_SETSID
setsid();
#else
setpgrp();
#endif /* NO_SETSID */
/* some OS's have SIGCLD defined as SIGCHLD */
#ifndef SIGCLD
#define SIGCLD SIGCHLD
#endif /* SIGCLD */
signal(SIGCLD, SIG_IGN);
#endif /* WIN32 */
for (;;)
{
if ((server_sock=accept(server_control,
&peeraddr,
&sockaddr_len)) == -1)
{
printf("server_control: accept failed\n");
exit(1);
}
#if defined(WIN32) || defined(MPE) || defined(__VMS)
/*
* Since we cannot fork this process , we cant fire any threads
* as they all share the same global data . So we better allow
* one request at at time
*/
process_requests() ;
}
#else
signal(SIGCLD, SIG_IGN);
switch (fork())
{
case -1:
/* something went wrong */
exit(1);
case 0:
/* we are the child process */
close(server_control);
process_requests();
exit(0);
break;
default:
/* we are the parent process */
close(server_sock);
/* we should try to "reap" some of our children. on some */
/* systems they are being left as defunct processes. we */
/* will call waitpid, looking for any child process, */
/* with the WNOHANG feature. when waitpid return a zero, */
/* we have reaped all the children there are to reap at */
/* the moment, so it is time to move on. raj 12/94 */
#ifndef DONT_WAIT
while(waitpid(-1, NULL, WNOHANG) > 0) { }
#endif /* DONT_WAIT */
break;
}
} /*for*/
break; /*case 0*/
default:
exit (0);
}
#endif /* WIN32 */
}
int
main(argc, argv)
int argc;
char *argv[];
{
int c;
int af = AF_INET;
struct sockaddr name;
int namelen = sizeof(name);
#ifdef WIN32
WSADATA wsa_data ;
/* Initialise the wsock lib ( version 1.1 ) */
if ( WSAStartup(0x0101,&wsa_data) == SOCKET_ERROR ){
printf("WSAStartup() fauled : %d\n",GetLastError()) ;
return 1 ;
}
#endif /* WIN32 */
netlib_init();
/* Scan the command line to see if we are supposed to set-up our own */
/* listen socket instead of relying on inetd. */
while ((c = getopt(argc, argv, SERVER_ARGS)) != EOF) {
switch (c) {
case '?':
case 'h':
print_netserver_usage();
exit(1);
case 'd':
/* we want to set the debug file name sometime */
debug++;
break;
case 'p':
/* we want to open a listen socket at a */
/* specified port number */
listen_port_num = atoi(optarg);
break;
case 'n':
shell_num_cpus = atoi(optarg);
if (shell_num_cpus > MAXCPUS) {
fprintf(stderr,
"netserver: This version can only support %d CPUs. Please",
MAXCPUS);
fprintf(stderr,
" increase MAXCPUS in netlib.h and recompile.\n");
fflush(stderr);
exit(1);
}
break;
#ifdef DO_IPV6
case '4':
af = AF_INET;
break;
case '6':
af = AF_INET6;
break;
#endif
}
}
/* unlink(DEBUG_LOG_FILE); */
if ((where = fopen(DEBUG_LOG_FILE, "w")) == NULL) {
perror("netserver: debug file");
exit(1);
}
chmod(DEBUG_LOG_FILE,0644);
/* if we were given a port number, then we should open a */
/* socket and hang listens off of it. otherwise, we should go */
/* straight into processing requests. the do_listen() routine */
/* will sit in an infinite loop accepting connections and */
/* forking child processes. the child processes will call */
/* process_requests */
/* If fd 0 is not a socket then assume we're not being called */
/* from inetd and start server socket on the default port. */
/* this enhancement comes from vwelch@ncsa.uiuc.edu (Von Welch) */
if (listen_port_num) {
/* the user specified a port number on the command line */
set_up_server(af);
}
#if !defined(__VMS)
else if (getsockname(0, &name, &namelen) == -1) {
/* we may not be a child of inetd */
#ifdef WIN32
if (WSAGetLastError() == WSAENOTSOCK) {
#else
if (errno == ENOTSOCK) {
#endif /* WIN32 */
listen_port_num = TEST_PORT;
set_up_server(af);
}
}
#endif /* !defined(__VMS) */
else {
/* we are probably a child of inetd, or are being invoked via the
VMS auxilliarly server mechanism */
#if !defined(__VMS)
server_sock = 0;
#else
if ( (server_sock = socket(TCPIP$C_AUXS, SOCK_STREAM, 0)) < 0 )
{
perror("Failed to grab aux server socket" );
exit(1);
}
#endif /* !defined(__VMS) */
process_requests();
}
return(0);
}

View File

@ -0,0 +1,57 @@
.TH netserver 8L ""
.SH NAME
netserver \- a network performance benchmark server
.SH SYNOPSIS
.B netserver
[-P portnum]
[-n numcpus]
.SH DESCRIPTION
.B Netserver
listens for connections from a
.C netperf
benchmark, and responds accordingly.
It can either be run from
.C inetd
or as a standalone daemon (with the -p flag). If run from
.C inetd
the -p option should not be used.
.SS OPTIONS
.TP
.B \-h
Display a usage string, and exit.
.TP
.B \-n numcpus
Specify the number of CPU's in the system on those systems for which
netperf has no way to find the number of CPU's programatically. (all
but HP-UX)
.TP
.B \-p portnum
Listen on the specified port.
This is used when running as a standalone daemon.
.SH BUGS
No known bugs at this time. If you think you have found a bug, please send email to Rick Jones <raj@cup.hp.com>.
.SH SEE ALSO
.C netperf
.br
.I
Netperf: A Network Performance Benchmark
.br
http://www.cup.hp.com/netperf/NetperfPage.html
.SH AUTHORS
HP Information Networks Division - Networking Performance Team.
.br
Rick Jones <raj@cup.hp.com>
.br
Karen Choy HP IND
.br
Dave Shield <daves@csc.liv.ac.uk> (man pages)
.br
Others too numerous to mention here - see the ACKNWLDGMNTS file

View File

@ -0,0 +1,3 @@
$ define sys$output sys$sysroot:[netperf]netperf.log
$ define sys$error sys$sysroot:[netperf]netperf.log
$ run sys$sysroot:[netperf]netserver.exe

View File

@ -0,0 +1,670 @@
#ifdef NEED_MAKEFILE_EDIT
#error you must first edit and customize the makefile to your platform
#endif /* NEED_MAKEFILE_EDIT */
char netsh_id[]="\
@(#)netsh.c (c) Copyright 1993-2003 Hewlett-Packard Company. Version 2.2pl3";
/****************************************************************/
/* */
/* Global include files */
/* */
/****************************************************************/
#include <sys/types.h>
#ifndef WIN32
#include <unistd.h>
#ifndef __VMS
#include <sys/ipc.h>
#endif /* __VMS */
#endif /* WIN32 */
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/* the following four includes should not be needed ?*/
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#ifndef STRINGS
#include <string.h>
#else /* STRINGS */
#include <strings.h>
#endif /* STRINGS */
#ifdef WIN32
extern int getopt(int , char **, char *) ;
#else
double atof();
#endif /* WIN32 */
/**********************************************************************/
/* */
/* Local Include Files */
/* */
/**********************************************************************/
#define NETSH
#include "netsh.h"
#include "netlib.h"
#include "nettest_bsd.h"
#ifdef DO_UNIX
#include "nettest_unix.h"
#include "sys/socket.h"
#endif /* DO_UNIX */
#ifdef DO_IPV6
#include "nettest_ipv6.h"
#endif /* DO_IPV6 */
/************************************************************************/
/* */
/* Global constants and macros */
/* */
/************************************************************************/
/* Some of the args take optional parameters. Since we are using */
/* getopt to parse the command line, we will tell getopt that they do */
/* not take parms, and then look for them ourselves */
#define GLOBAL_CMD_LINE_ARGS "A:a:b:CcdDf:F:H:hi:I:l:n:O:o:P:p:t:v:W:w:46"
/************************************************************************/
/* */
/* Extern variables */
/* */
/************************************************************************/
/*
extern int errno;
extern char *sys_errlist[ ];
extern int sys_nerr;
*/
/************************************************************************/
/* */
/* Global variables */
/* */
/************************************************************************/
/* some names and such */
char *program; /* program invocation name */
char username[BUFSIZ]; /* login name of user */
char cmd_file[BUFSIZ]; /* name of the commands file */
/* stuff to say where this test is going */
char host_name[HOSTNAMESIZE]; /* remote host name or ip addr */
char test_name[BUFSIZ]; /* which test to run */
short test_port; /* where is the test waiting */
/* the source of data for filling the buffers */
char fill_file[BUFSIZ];
/* output controlling variables */
int
debug, /* debugging level */
print_headers, /* do/don't display headers */
verbosity; /* verbosity level */
/* cpu variables */
int
local_cpu_usage, /* you guessed it */
remote_cpu_usage; /* still right ! */
float
local_cpu_rate,
remote_cpu_rate;
int
shell_num_cpus=1;
/* the end-test conditions for the tests - either transactions, bytes, */
/* or time. different vars used for clarity - space is cheap ;-) */
int
test_time, /* test ends by time */
test_len_ticks, /* how many times will the timer go off before */
/* the test is over? */
test_bytes, /* test ends on byte count */
test_trans; /* test ends on tran count */
/* the alignment conditions for the tests */
int
local_recv_align, /* alignment for local receives */
local_send_align, /* alignment for local sends */
local_send_offset = 0,
local_recv_offset = 0,
remote_recv_align, /* alignment for remote receives */
remote_send_align, /* alignment for remote sends */
remote_send_offset = 0,
remote_recv_offset = 0;
#ifdef INTERVALS
int
interval_usecs,
interval_wate,
interval_burst;
int demo_mode;
double units_this_tick;
#endif /* INTERVALS */
#ifdef DIRTY
int loc_dirty_count;
int loc_clean_count;
int rem_dirty_count;
int rem_clean_count;
#endif /* DIRTY */
/* some of the vairables for confidence intervals... */
int confidence_level;
int iteration_min;
int iteration_max;
double interval;
/* stuff to control the "width" of the buffer rings for sending and */
/* receiving data */
int send_width;
int recv_width;
/* address family */
int af = AF_INET;
char netserver_usage[] = "\n\
Usage: netserver [options] \n\
\n\
Options:\n\
-h Display this text\n\
-p portnum Listen for connect requests on portnum.\n\
\n";
char netperf_usage[] = "\n\
Usage: netperf [global options] -- [test options] \n\
\n\
Global options:\n\
-a send,recv Set the local send,recv buffer alignment\n\
-A send,recv Set the remote send,recv buffer alignment\n\
-c [cpu_rate] Report local CPU usage\n\
-C [cpu_rate] Report remote CPU usage\n\
-d Increase debugging output\n\
-f G|M|K|g|m|k Set the output units\n\
-F fill_file Pre-fill buffers with data from fill_file\n\
-h Display this text\n\
-H name|ip Specify the target machine\n\
-i max,min Specify the max and min number of iterations (15,1)\n\
-I lvl[,intvl] Specify confidence level (95 or 99) (99) \n\
and confidence interval in percentage (10)\n\
-l testlen Specify test duration (>0 secs) (<0 bytes|trans)\n\
-o send,recv Set the local send,recv buffer offsets\n\
-O send,recv Set the remote send,recv buffer offset\n\
-n numcpu Set the number of processors for CPU util\n\
-p port Specify netserver port number\n\
-P 0|1 Don't/Do display test headers\n\
-t testname Specify test to perform\n\
-v verbosity Specify the verbosity level\n\
-W send,recv Set the number of send,recv buffers\n\
\n\
For those options taking two parms, at least one must be specified;\n\
specifying one value without a comma will set both parms to that\n\
value, specifying a value with a leading comma will set just the second\n\
parm, a value with a trailing comma will set just the first. To set\n\
each parm to unique values, specify both and separate them with a\n\
comma.\n";
/* This routine will return the two arguments to the calling routine. */
/* If the second argument is not specified, and there is no comma, */
/* then the value of the second argument will be the same as the */
/* value of the first. If there is a comma, then the value of the */
/* second argument will be the value of the second argument ;-) */
void
break_args(s, arg1, arg2)
char *s, *arg1, *arg2;
{
char *ns;
ns = strchr(s,',');
if (ns) {
/* there was a comma arg2 should be the second arg*/
*ns++ = '\0';
while ((*arg2++ = *ns++) != '\0');
}
else {
/* there was not a comma, we can use ns as a temp s */
/* and arg2 should be the same value as arg1 */
ns = s;
while ((*arg2++ = *ns++) != '\0');
};
while ((*arg1++ = *s++) != '\0');
}
void
set_defaults()
{
/* stuff to say where this test is going */
strcpy(host_name,"localhost"); /* remote host name or ip addr */
strcpy(test_name,"TCP_STREAM"); /* which test to run */
test_port = 12865; /* where is the test waiting */
/* output controlling variables */
debug = 0;/* debugging level */
print_headers = 1;/* do print test headers */
verbosity = 1;/* verbosity level */
/* cpu variables */
local_cpu_usage = 0;/* measure local cpu */
remote_cpu_usage = 0;/* what do you think ;-) */
local_cpu_rate = (float)0.0;
remote_cpu_rate = (float)0.0;
/* the end-test conditions for the tests - either transactions, bytes, */
/* or time. different vars used for clarity - space is cheap ;-) */
test_time = 10; /* test ends by time */
test_bytes = 0; /* test ends on byte count */
test_trans = 0; /* test ends on tran count */
/* the alignment conditions for the tests */
local_recv_align = 8; /* alignment for local receives */
local_send_align = 8; /* alignment for local sends */
remote_recv_align = 8; /* alignment for remote receives*/
remote_send_align = 8; /* alignment for remote sends */
#ifdef INTERVALS
/* rate controlling stuff */
interval_usecs = 0;
interval_wate = 1;
interval_burst = 0;
#endif /* INTERVALS */
#ifdef DIRTY
/* dirty and clean cache stuff */
loc_dirty_count = 0;
loc_clean_count = 0;
rem_dirty_count = 0;
rem_clean_count = 0;
#endif /* DIRTY */
/* some of the vairables for confidence intervals... */
confidence_level = 99;
iteration_min = 1;
iteration_max = 1;
interval = 0.05; /* five percent? */
strcpy(fill_file,"");
}
void
print_netserver_usage()
{
fprintf(stderr,netserver_usage);
}
void
print_netperf_usage()
{
fprintf(stderr,netperf_usage);
}
void
scan_cmd_line(argc, argv)
int argc;
char *argv[];
{
extern int optind; /* index of first unused arg */
extern char *optarg; /* pointer to option string */
int c;
char arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ];
program = (char *)malloc(strlen(argv[0]) + 1);
strcpy(program, argv[0]);
/* Go through all the command line arguments and break them */
/* out. For those options that take two parms, specifying only */
/* the first will set both to that value. Specifying only the */
/* second will leave the first untouched. To change only the */
/* first, use the form first, (see the routine break_args.. */
while ((c= getopt(argc, argv, GLOBAL_CMD_LINE_ARGS)) != EOF) {
switch (c) {
case '?':
case 'h':
print_netperf_usage();
exit(1);
case 'a':
/* set local alignments */
break_args(optarg,arg1,arg2);
if (arg1[0]) {
local_send_align = convert(arg1);
}
if (arg2[0])
local_recv_align = convert(arg2);
break;
case 'A':
/* set remote alignments */
break_args(optarg,arg1,arg2);
if (arg1[0]) {
remote_send_align = convert(arg1);
}
if (arg2[0])
remote_recv_align = convert(arg2);
break;
case 'd':
debug++;
break;
case 'D':
#if (defined INTERVALS) && (defined __hpux)
demo_mode++;
#else /* INTERVALS __hpux */
printf("Sorry, Demo Mode requires -DINTERVALS compilation \n");
printf("as well as a mechanism to dynamically select syscall \n");
printf("restart or interruption. I only know how to do this \n");
printf("for HP-UX. Please examine the code in netlib.c:catcher() \n");
printf("and let me know of more standard alternatives. \n");
printf(" Rick Jones <raj@cup.hp.com>\n");
exit(1);
#endif /* INTERVALS __hpux */
break;
case 'f':
/* set the thruput formatting */
libfmt = *optarg;
break;
case 'F':
/* set the fill_file variable for pre-filling buffers */
strcpy(fill_file,optarg);
break;
case 'i':
/* set the iterations min and max for confidence intervals */
break_args(optarg,arg1,arg2);
if (arg1[0]) {
iteration_max = convert(arg1);
}
if (arg2[0] ) {
iteration_min = convert(arg2);
}
/* limit maximum to 30 iterations */
if(iteration_max>30) iteration_max=30;
if(iteration_min>30) iteration_min=30;
break;
case 'I':
/* set the confidence level (95 or 99) and width */
break_args(optarg,arg1,arg2);
if (arg1[0]) {
confidence_level = convert(arg1);
}
if((confidence_level != 95) && (confidence_level != 99)){
printf("Only 95%% and 99%% confidence level is supported\n");
exit(1);
}
if (arg2[0] ) {
interval = (double) convert(arg2)/100;
}
break;
case 'k':
/* local dirty and clean counts */
#ifdef DIRTY
break_args(optarg,arg1,arg2);
if (arg1[0]) {
loc_dirty_count = convert(arg1);
}
if (arg2[0] ) {
loc_clean_count = convert(arg2);
}
#else
printf("I don't know how to get dirty.\n");
#endif /* DIRTY */
break;
case 'K':
/* remote dirty and clean counts */
#ifdef DIRTY
break_args(optarg,arg1,arg2);
if (arg1[0]) {
rem_dirty_count = convert(arg1);
}
if (arg2[0] ) {
rem_clean_count = convert(arg2);
}
#else
printf("I don't know how to get dirty.\n");
#endif /* DIRTY */
break;
case 'n':
shell_num_cpus = atoi(optarg);
break;
case 'o':
/* set the local offsets */
break_args(optarg,arg1,arg2);
if (arg1[0])
local_send_offset = convert(arg1);
if (arg2[0])
local_recv_offset = convert(arg2);
break;
case 'O':
/* set the remote offsets */
break_args(optarg,arg1,arg2);
if (arg1[0])
remote_send_offset = convert(arg1);
if (arg2[0])
remote_recv_offset = convert(arg2);
break;
case 'P':
/* to print or not to print, that is */
/* the header question */
print_headers = convert(optarg);
break;
case 't':
/* set the test name */
strcpy(test_name,optarg);
break;
case 'W':
/* set the "width" of the user space data buffer ring. This will */
/* be the number of send_size buffers malloc'd in the tests */
break_args(optarg,arg1,arg2);
if (arg1[0])
send_width = convert(arg1);
if (arg2[0])
recv_width = convert(arg2);
break;
case 'l':
/* determine test end conditions */
/* assume a timed test */
test_time = convert(optarg);
test_bytes = test_trans = 0;
if (test_time < 0) {
test_bytes = -1 * test_time;
test_trans = test_bytes;
test_time = 0;
}
break;
case 'v':
/* say how much to say */
verbosity = convert(optarg);
break;
case 'c':
/* measure local cpu usage please. the user */
/* may have specified the cpu rate as an */
/* optional parm */
if (argv[optind] && isdigit(argv[optind][0])){
/* there was an optional parm */
local_cpu_rate = (float)atof(argv[optind]);
optind++;
}
local_cpu_usage++;
break;
case 'C':
/* measure remote cpu usage please */
if (argv[optind] && isdigit(argv[optind][0])){
/* there was an optional parm */
remote_cpu_rate = (float)atof(argv[optind]);
optind++;
}
remote_cpu_usage++;
break;
case 'p':
/* specify an alternate port number */
test_port = (short) convert(optarg);
break;
case 'H':
/* save-off the host identifying information */
strcpy(host_name,optarg);
break;
case 'w':
/* We want to send requests at a certain wate. */
/* Remember that there are 1000000 usecs in a */
/* second, and that the packet rate is */
/* expressed in packets per millisecond. */
#ifdef INTERVALS
interval_wate = convert(optarg);
interval_usecs = interval_wate * 1000;
#else
fprintf(where,
"Packet rate control is not compiled in.\n");
#endif
break;
case 'b':
/* we want to have a burst so many packets per */
/* interval. */
#ifdef INTERVALS
interval_burst = convert(optarg);
#else
fprintf(where,
"Packet burst size is not compiled in. \n");
#endif /* INTERVALS */
break;
};
}
/* we have encountered a -- in global command-line */
/* processing and assume that this means we have gotten to the */
/* test specific options. this is a bit kludgy and if anyone has */
/* a better solution, i would love to see it */
if (optind != argc) {
if ((strcasecmp(test_name,"TCP_STREAM") == 0) ||
#ifdef HAVE_SENDFILE
(strcasecmp(test_name,"TCP_SENDFILE") == 0) ||
#endif /* HAVE_SENDFILE */
(strcasecmp(test_name,"TCP_MAERTS") == 0) ||
(strcasecmp(test_name,"TCP_RR") == 0) ||
(strcasecmp(test_name,"TCP_CRR") == 0) ||
#ifdef DO_1644
(strcasecmp(test_name,"TCP_TRR") == 0) ||
#endif /* DO_1644 */
#ifdef DO_NBRR
(strcasecmp(test_name,"TCP_TRR") == 0) ||
#endif /* DO_NBRR */
(strcasecmp(test_name,"UDP_STREAM") == 0) ||
(strcasecmp(test_name,"UDP_RR") == 0))
{
scan_sockets_args(argc, argv);
}
#ifdef DO_DLPI
else if ((strcasecmp(test_name,"DLCO_RR") == 0) ||
(strcasecmp(test_name,"DLCL_RR") == 0) ||
(strcasecmp(test_name,"DLCO_STREAM") == 0) ||
(strcasecmp(test_name,"DLCL_STREAM") == 0))
{
scan_dlpi_args(argc, argv);
}
#endif /* DO_DLPI */
#ifdef DO_UNIX
else if ((strcasecmp(test_name,"STREAM_RR") == 0) ||
(strcasecmp(test_name,"DG_RR") == 0) ||
(strcasecmp(test_name,"STREAM_STREAM") == 0) ||
(strcasecmp(test_name,"DG_STREAM") == 0))
{
scan_unix_args(argc, argv);
}
#endif /* DO_UNIX */
#ifdef DO_FORE
else if ((strcasecmp(test_name,"FORE_RR") == 0) ||
(strcasecmp(test_name,"FORE_STREAM") == 0))
{
scan_fore_args(argc, argv);
}
#endif /* DO_FORE */
#ifdef DO_HIPPI
else if ((strcasecmp(test_name,"HIPPI_RR") == 0) ||
(strcasecmp(test_name,"HIPPI_STREAM") == 0))
{
scan_hippi_args(argc, argv);
}
#endif /* DO_HIPPI */
#ifdef DO_XTI
else if ((strcasecmp(test_name,"XTI_TCP_RR") == 0) ||
(strcasecmp(test_name,"XTI_TCP_STREAM") == 0) ||
(strcasecmp(test_name,"XTI_UDP_RR") == 0) ||
(strcasecmp(test_name,"XTI_UDP_STREAM") == 0))
{
scan_xti_args(argc, argv);
}
#endif /* DO_XTI */
#ifdef DO_LWP
else if ((strcasecmp(test_name,"LWPSTR_RR") == 0) ||
(strcasecmp(test_name,"LWPSTR_STREAM") == 0) ||
(strcasecmp(test_name,"LWPDG_RR") == 0) ||
(strcasecmp(test_name,"LWPDG_STREAM") == 0))
{
scan_lwp_args(argc, argv);
}
#endif /* DO_LWP */
#ifdef DO_IPV6
else if ((strcasecmp(test_name,"TCPIPV6_RR") == 0) ||
(strcasecmp(test_name,"TCPIPV6_CRR") == 0) ||
(strcasecmp(test_name,"TCPIPV6_STREAM") == 0) ||
(strcasecmp(test_name,"UDPIPV6_RR") == 0) ||
(strcasecmp(test_name,"UDPIPV6_STREAM") == 0))
{
scan_ipv6_args(argc, argv);
}
#endif /* DO_IPV6 */
#ifdef DO_DNS
else if (strcasecmp(test_name,"DNS_RR") == 0)
{
scan_dns_args(argc, argv);
}
#endif /* DO_DNS */
}
#ifdef DO_IPV6
/* address family check */
if ((strcasecmp(test_name,"TCPIPV6_RR") == 0) ||
(strcasecmp(test_name,"TCPIPV6_CRR") == 0) ||
(strcasecmp(test_name,"TCPIPV6_STREAM") == 0) ||
(strcasecmp(test_name,"UDPIPV6_RR") == 0) ||
(strcasecmp(test_name,"UDPIPV6_STREAM") == 0))
{
af = AF_INET6;
}
#endif /* DO_IPV6 */
}
void
dump_globals()
{
printf("Program name: %s\n", program);
printf("Local send alignment: %d\n",local_send_align);
printf("Local recv alignment: %d\n",local_recv_align);
printf("Remote send alignment: %d\n",remote_send_align);
printf("Remote recv alignment: %d\n",remote_recv_align);
printf("Report local CPU %d\n",local_cpu_usage);
printf("Report remote CPU %d\n",remote_cpu_usage);
printf("Verbosity: %d\n",verbosity);
printf("Debug: %d\n",debug);
printf("Port: %d\n",test_port);
printf("Test name: %s\n",test_name);
printf("Test bytes: %d Test time: %d Test trans: %d\n",
test_bytes,
test_time,
test_trans);
printf("Host name: %s\n",host_name);
printf("\n");
}

View File

@ -0,0 +1,129 @@
/*
Copyright (C) 1993,1995 Hewlett-Packard Company
*/
/* libraried performance include file */
/* the define NOPERFEXTERN tels us not to re-define all the */
/* defines and defaults */
#define HOSTNAMESIZE 255
#define DEFAULT_SIZE 32768
#define HOST_NAME "127.0.0.1"
#define TEST_PORT 12865
/* output controlling variables */
#define DEBUG 0 /* debugging level */
#define VERBOSITY 0 /* verbosity level */
/* the end-test conditions for the tests - either transactions, bytes, */
/* or time. different vars used for clarity - space is cheap ;-) */
#define TEST_TIME 10 /* test ends by time */
#define TEST_BYTES 0 /* test ends on byte count */
#define TEST_TRANS 0 /* test ends on tran count */
/* the alignment conditions for the tests */
#define LOC_RECV_ALIGN 4 /* alignment for local receives */
#define LOC_SEND_ALIGN 4 /* alignment for local sends */
#define REM_RECV_ALIGN 4 /* alignment for remote receive */
#define REM_SEND_ALIGN 4 /* alignment for remote sends */
/* misc defines for the hell of it */
#ifndef MAXLONG
#define MAXLONG 4294967295UL
#endif /* MAXLONG */
#ifndef NETSH
/* stuff to say where this test is going */
extern char host_name[HOSTNAMESIZE];/* remote host name or ip addr */
extern short test_port; /* where is the test waiting */
extern void set_defaults();
extern void scan_cmd_line();
extern void dump_globals();
extern void break_args();
extern void print_netserver_usage();
/* output controlling variables */
extern int
debug, /* debugging level */
print_headers, /* do/don't print test headers */
verbosity; /* verbosity level */
/* the end-test conditions for the tests - either transactions, bytes, */
/* or time. different vars used for clarity - space is cheap ;-) */
extern int
test_time, /* test ends by time */
test_len_ticks,
test_bytes, /* test ends on byte count */
test_trans; /* test ends on tran count */
/* the alignment conditions for the tests */
extern int
local_recv_align, /* alignment for local receives */
local_send_align, /* alignment for local sends */
remote_recv_align, /* alignment for remote receives */
remote_send_align, /* alignment for remote sends */
local_send_offset,
local_recv_offset,
remote_send_offset,
remote_recv_offset;
#ifdef INTERVALS
extern int interval_usecs;
extern int interval_wate;
extern int interval_burst;
extern int demo_mode;
extern unsigned int units_this_tick;
#endif /* INTERVALS */
#ifdef DIRTY
extern int rem_dirty_count;
extern int rem_clean_count;
extern int loc_dirty_count;
extern int loc_clean_count;
#endif /* DIRTY */
/* stuff for confidence intervals */
extern int confidence_level;
extern int iteration_min;
extern int iteration_max;
extern double interval;
/* stuff to controll the bufferspace "width" */
extern int send_width;
extern int recv_width;
/* address family */
extern int af;
/* different options for other things */
extern int
local_cpu_usage,
remote_cpu_usage;
extern float
local_cpu_rate,
remote_cpu_rate;
extern int
shell_num_cpus;
extern char
test_name[BUFSIZ];
extern char
fill_file[BUFSIZ];
#ifdef DO_DLPI
extern int
loc_ppa,
rem_ppa;
extern int
dlpi_sap;
#endif /* DO_DLPI */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,366 @@
/*
Copyright (C) 1993-2003 Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's BSD */
/* sockets tests */
struct tcp_stream_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
/* receive socket buffer that is */
int receive_size; /* how many bytes do we want to receive at one */
/* time? */
int recv_alignment; /* what is the alignment of the receive */
/* buffer? */
int recv_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
/* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
/* measured? */
float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
/* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the receive buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
};
struct tcp_stream_response_struct {
int recv_buf_size; /* how big does the client want it */
int receive_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_stream_results_struct {
double bytes_received;
unsigned int recv_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcp_maerts_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
/* receive socket buffer that is */
int send_size; /* how many bytes do we want netserver to send
at one time? */
int send_alignment; /* what is the alignment of the send */
/* buffer? */
int send_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
/* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
/* measured? */
float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
/* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the send buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
};
struct tcp_maerts_response_struct {
int recv_buf_size; /* how big does the client want it */
int send_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_maerts_results_struct {
double bytes_sent;
unsigned int send_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcp_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcp_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcp_conn_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcp_conn_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_conn_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcp_tran_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcp_tran_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_tran_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct udp_stream_request_struct {
int recv_buf_size;
int message_size;
int recv_alignment;
int recv_offset;
int checksum_off;
int measure_cpu;
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct udp_stream_response_struct {
int recv_buf_size;
int send_buf_size;
int measure_cpu;
int test_length;
int data_port_number;
float cpu_rate;
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct udp_stream_results_struct {
unsigned int messages_recvd;
unsigned int bytes_received;
float elapsed_time;
float cpu_util;
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct udp_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct udp_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct udp_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcp_cc_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcp_cc_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcp_cc_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
extern void scan_sockets_args();
extern void send_tcp_stream();
extern void send_tcp_maerts();
extern void send_tcp_rr();
extern void send_tcp_conn_rr();
extern void send_tcp_cc();
extern void send_udp_stream();
extern void send_udp_rr();
extern void recv_tcp_stream();
extern void recv_tcp_maerts();
extern void recv_tcp_rr();
extern void recv_tcp_conn_rr();
extern void recv_tcp_cc();
extern void recv_udp_stream();
extern void recv_udp_rr();
extern void loc_cpu_rate();
extern void rem_cpu_rate();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,197 @@
/*
Copyright (C) 1993, Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's */
/* DLPI tests */
#define PAD_TIME 2
struct dlpi_co_stream_request_struct {
int recv_win_size;
int send_win_size;
int receive_size; /* how many bytes do we want to */
/* receive at one time? */
int recv_alignment; /* what is the alignment of the */
/* receive buffer? */
int recv_offset; /* and at what offset from that */
/* alignment? */
int measure_cpu; /* does the client want server cpu */
/* utilization measured? */
float cpu_rate; /* do we know how fast the cpu is */
/* already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid */
/* copies on receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the receive buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
int sap; /* */
int ppa; /* which device do we wish to use? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char dlpi_device[32]; /* the path to the dlpi device */
};
struct dlpi_co_stream_response_struct {
int recv_win_size; /* how big does the client want it */
int send_win_size;
int receive_size;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int station_addr_len;
int station_addr[1];/* what is the station address for the */
/* specified ppa? */
};
struct dlpi_co_stream_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was CPU util measured? */
int num_cpus; /* how many CPUs were there? */
};
struct dlpi_co_rr_request_struct {
int recv_win_size; /* how big does the client want it */
int send_win_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int ppa; /* which device do we wish to use? */
int sap; /* which sap should be used? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char dlpi_device[32]; /* the path to the dlpi device */
};
struct dlpi_co_rr_response_struct {
int recv_win_size; /* how big does the client want it */
int send_win_size;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int station_addr_len; /* the length of the station address */
int station_addr[1]; /* the remote's station address */
};
struct dlpi_co_rr_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was CPU util measured? */
int num_cpus; /* how many CPUs were there? */
};
struct dlpi_cl_stream_request_struct {
int recv_win_size;
int message_size;
int recv_alignment;
int recv_offset;
int checksum_off;
int measure_cpu;
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int ppa; /* which device do we wish to use? */
int sap;
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char dlpi_device[32]; /* the path to the dlpi device */
};
struct dlpi_cl_stream_response_struct {
int recv_win_size;
int send_win_size;
int measure_cpu;
int test_length;
int data_port_number;
float cpu_rate;
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int station_addr_len; /* the length of the station address */
int station_addr[1]; /* the remote's station address */
};
struct dlpi_cl_stream_results_struct {
int messages_recvd;
int bytes_received;
float elapsed_time;
float cpu_util;
};
struct dlpi_cl_rr_request_struct {
int recv_win_size; /* how big does the client want it */
int send_win_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int ppa; /* which device do we wish to use? */
int sap; /* which sap? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char dlpi_device[32]; /* the path to the dlpi device */
};
struct dlpi_cl_rr_response_struct {
int recv_win_size; /* how big does the client want it */
int send_win_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int station_addr_len; /* the length of the station address */
int station_addr[1]; /* the remote's station address */
};
struct dlpi_cl_rr_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was CPU util measured? */
int num_cpus; /* how many CPUs were there? */
};

View File

@ -0,0 +1,888 @@
#ifdef DO_DNS
#ifndef lint
char nettest_dns_id[]="\
@(#)nettest_dns.c (c) Copyright 1997 Hewlett-Packard Co. Version 2.1pl4";
#else
#define DIRTY
#define HISTOGRAM
#define INTERVALS
#endif /* lint */
/****************************************************************/
/* */
/* nettest_dns.c */
/* */
/* scan_dns_args() */
/* */
/* the actual test routines... */
/* */
/* send_dns_rr() perform a dns request/response */
/* recv_dns_rr() */
/* */
/****************************************************************/
/* For the first iteration of this suite, netperf will rely on the */
/* gethostbyname() and gethostbyaddr() calls instead of making DNS */
/* calls directly. Later, when there is more time, this may be */
/* altered so that the netperf code is making the DNS requests */
/* directly, which would mean that more of the test could be */
/* controlled directly from netperf instead of indirectly through */
/* config files. raj 7/97 */
/* In this suite, the netserver process really is not involved, it */
/* only measures CPU utilization over the test interval. Of course, */
/* this presumes that the netserver process will be running on the */
/* same machine as the DNS server :) raj 7/97 */
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef NOSTDLIBH
#include <malloc.h>
#else /* NOSTDLIBH */
#include <stdlib.h>
#endif /* NOSTDLIBH */
#ifndef WIN32
#include <sys/ipc.h>
#include <unistd.h>
#
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <arpa/nameser.h>
#include <resolv.h>
#else /* WIN32 */
#include <process.h>
#include <windows.h>
#include <winsock.h>
#define close(x) closesocket(x)
#endif /* WIN32 */
#include "netlib.h"
#include "netsh.h"
#include "nettest_dns.h"
#ifdef HISTOGRAM
#ifdef __sgi
#include <sys/time.h>
#endif /* __sgi */
#include "hist.h"
#endif /* HISTOGRAM */
/* these variables are specific to the DNS tests. declare them static */
/* to make them global only to this file. */
static int confidence_iteration;
static char local_cpu_method;
static char remote_cpu_method;
static char request_file[1024];
static unsigned int dns_server_addr = INADDR_ANY;
#ifdef HISTOGRAM
static struct timeval time_one;
static struct timeval time_two;
static HIST time_hist;
#endif /* HISTOGRAM */
char dns_usage[] = "\n\
Usage: netperf [global options] -- [test options] \n\
\n\
DNS Test Options:\n\
-f filename Specify the request source file\n\
Default: /tmp/netperf_dns_requests\n\
-h Display this text\n\
\n\
For those options taking two parms, at least one must be specified;\n\
specifying one value without a comma will set both parms to that\n\
value, specifying a value with a leading comma will set just the second\n\
parm, a value with a trailing comma will set just the first. To set\n\
each parm to unique values, specify both and separate them with a\n\
comma.\n";
/* this routine implements the client (netperf) side of the DNS_RR */
/* test. */
void
send_dns_rr(remote_host)
char remote_host[];
{
char *tput_title = "\
Elapsed Transaction\n\
Time Rate \n\
Seconds per second \n\n";
char *tput_fmt_0 =
"%7.2f\n";
char *tput_fmt_1_line_1 = "\
%-6.2f %7.2f \n";
char *tput_fmt_1_line_2 = "\
%-6d %-6d\n";
char *cpu_title = "\
Elapsed Trans. CPU CPU S.dem S.dem\n\
Time Rate local remote local remote\n\
secs. per sec %% %c %% %c us/Tr us/Tr\n\n";
char *cpu_fmt_0 =
"%6.3f %c\n";
char *cpu_fmt_1_line_1 = "\
%-6.2f %-6.2f %-6.2f %-6.2f %-6.3f %-6.3f\n";
int timed_out = 0;
float elapsed_time;
/* char *temp_message_ptr; */
int numtrans;
int trans_remaining;
float local_cpu_utilization;
float local_service_demand;
float remote_cpu_utilization;
float remote_service_demand;
double thruput;
struct hostent *hp;
unsigned int addr;
struct dns_rr_request_struct *dns_rr_request;
struct dns_rr_response_struct *dns_rr_response;
struct dns_rr_results_struct *dns_rr_result;
/* we will save the old resolver state here and then muck with the */
/* copy. of course, if we are just going to exit anyway, I'm not sure */
/* if we need to save the state or not :) this is slightly */
/* complicated in that on some old systems (eg HP-UX 9.X) , the */
/* variable type is "state", where on newer systems (eg HP-UX 10.30), */
/* the variable type is _res_state. raj 7/97 */
#ifdef __RES
struct __res_state saved_res;
#else /* __RES */
struct state saved_res;
#endif /* __RES */
/* these will be parameters to res_query() at some point, they will */
/* come from the log file used to drive the test. for now, they will */
/* be hard-coded. raj 7/97 */
int class = C_IN; /* Internet class of resource records */
int type = T_A; /* basic host address lookup */
u_char server_response[1024]; /* where the data goes */
int len = sizeof(server_response);
#ifdef INTERVALS
int interval_count;
sigset_t signal_set;
#endif /* INTERVALS */
dns_rr_request =
(struct dns_rr_request_struct *)netperf_request.content.test_specific_data;
dns_rr_response=
(struct dns_rr_response_struct *)netperf_response.content.test_specific_data;
dns_rr_result =
(struct dns_rr_results_struct *)netperf_response.content.test_specific_data;
/* we need to get the IP address of the DNS server we will be */
/* accessing. Because it may not be possible to run netserver on the */
/* system acting as the DNS server, there is a test-specific option */
/* to specify the name/addr of the DNS server. if that is not set, */
/* we will use the hostname associated with the control connection. */
/* we want to look this information-up *before* we redirect the */
/* resolver libraries to the DNS SUT :) raj 7/97 */
if (dns_server_addr == INADDR_ANY) {
/* we use the control connection hostname as the way to find the */
/* IP address of the DNS SUT */
if ((dns_server_addr = inet_addr(remote_host)) == -1) {
/* it was not an IP address, try it as a name, if it was */
/* all-ones broadcast, we don't want to send to that anyway */
if ((hp = gethostbyname(remote_host)) == NULL) {
/* we have no idea what it is */
fprintf(where,
"send_dns_rr: could not resolve the DNS SUT %s\n",
remote_host);
fflush(where);
exit(1);
}
else {
/* it was a valid remote_host. at some point, we really need */
/* to worry about IPv6 addresses and such, for now simply */
/* assume v4 and a four byte address */
bcopy(hp->h_addr,
(char *)&dns_server_addr,
4);
}
}
}
#ifdef HISTOGRAM
time_hist = HIST_new();
#endif /* HISTOGRAM */
if ( print_headers ) {
fprintf(where,"DNS REQUEST/RESPONSE TEST");
fprintf(where," to %s", inet_ntoa(dns_server_addr));
if (iteration_max > 1) {
fprintf(where,
" : +/-%3.1f%% @ %2d%% conf.",
interval/0.02,
confidence_level);
}
#ifdef HISTOGRAM
fprintf(where," : histogram");
#endif /* HISTOGRAM */
#ifdef INTERVALS
fprintf(where," : interval");
#endif /* INTERVALS */
fprintf(where,"\n");
}
/* initialize a few counters */
confidence_iteration = 1;
init_stat();
/* we previoulsy used gethostbyname to establish the control */
/* connection t the netwserver. now we want to have our DNS queries */
/* go to the SUT, not the DNS server that got us the control */
/* connection information. so, we save the old resolver state (may */
/* not really be needed) and then set it up with the IP address of */
/* the DNS server we really want to access. if netperf ever goes */
/* threaded, this will have to be revisisted. raj 7/97 */
bcopy((char *) &_res, (char *)&saved_res, sizeof(_res));
/* switch the state over to the test server and set the count */
/* correctly. there are probably other things we want to play with */
/* too, but those will have to wait until later. by doing this */
/* switch, we bypass anything in the /etc/resolv.conf file of the */
/* client, elminates netperf's dependency on that file being set-up */
/* correctly for the test. raj 7/97 */
_res.nscount = 1;
_res.nsaddr_list[0].sin_addr.s_addr = dns_server_addr;
/* we have a great-big while loop which controls the number of times */
/* we run a particular test. this is for the calculation of a */
/* confidence interval (I really should have stayed awake during */
/* probstats :). If the user did not request confidence measurement */
/* (no confidence is the default) then we will only go though the */
/* loop once. the confidence stuff originates from the folks at IBM */
while (((confidence < 0) && (confidence_iteration < iteration_max)) ||
(confidence_iteration <= iteration_min)) {
/* initialize a few counters. we have to remember that we might be */
/* going through the loop more than once. */
numtrans = 0;
times_up = 0;
timed_out = 0;
trans_remaining = 0;
if (debug) {
fprintf(where,"send_dns_rr: counter initialization complete...\n");
}
/* If the user has requested cpu utilization measurements, we must */
/* calibrate the cpu(s). We will perform this task within the tests */
/* themselves. If the user has specified the cpu rate, then */
/* calibrate_local_cpu will return rather quickly as it will have */
/* nothing to do. If local_cpu_rate is zero, then we will go through */
/* all the "normal" calibration stuff and return the rate back.*/
if (local_cpu_usage) {
local_cpu_rate = calibrate_local_cpu(local_cpu_rate);
}
/* Tell the remote end to get ready. All the netserver side really */
/* does in this test is measure CPU utilization. raj 7/97 */
netperf_request.content.request_type = DO_DNS_RR;
dns_rr_request->measure_cpu = remote_cpu_usage;
dns_rr_request->cpu_rate = remote_cpu_rate;
if (test_time) {
dns_rr_request->test_length = test_time;
}
else {
/* the DNS tests only support running for a length of time, so */
/* if the user requested a number of transactions, we must abort */
/* and tell him why. raj 7/97 */
fprintf(where,
"netperf send_dns_rr: test length must be a time\n");
fflush(where);
exit(1);
}
if (debug > 1) {
fprintf(where,"netperf: send_dns_rr: requesting DNS rr test\n");
}
send_request();
/* The response from the remote will contain all of the relevant */
/* parameters for this test type. We will put them back into the */
/* variables here so they can be displayed if desired. The remote */
/* will have calibrated CPU if necessary, and will have done all */
/* the needed set-up we will have calibrated the cpu locally */
/* before sending the request, and will grab the counter value */
/* right after the response returns. The remote will grab the */
/* counter right after the response is sent. This is about as */
/* close as we can get them - we trust that the delta will be */
/* sufficiently small. raj 7/97 */
recv_response();
if (!netperf_response.content.serv_errno) {
remote_cpu_usage = dns_rr_response->measure_cpu;
remote_cpu_rate = dns_rr_response->cpu_rate;
if (debug) {
fprintf(where,"remote listen done.\n");
fprintf(where," cpu_rate %g\n",remote_cpu_rate);
fflush(where);
}
}
else {
errno = netperf_response.content.serv_errno;
fprintf(where,
"netperf: remote error %d",
netperf_response.content.serv_errno);
perror("");
fflush(where);
exit(1);
}
/* Set-up the test end conditions. For a DNS_RR test, this can */
/* only be time based, and that was checked earlier. raj 7/97 */
times_up = 0;
start_timer(test_time);
/* The cpu_start routine will grab the current time and possibly */
/* value of the idle counter for later use in measuring cpu */
/* utilization and/or service demand and thruput. */
cpu_start(local_cpu_usage);
#ifdef INTERVALS
if ((interval_burst) || (demo_mode)) {
/* zero means that we never pause, so we never should need the */
/* interval timer, unless we are in demo_mode */
start_itimer(interval_wate);
}
interval_count = interval_burst;
/* get the signal set for the call to sigsuspend */
if (sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &signal_set) != 0) {
fprintf(where,
"send_dns_rr: unable to get sigmask errno %d\n",
errno);
fflush(where);
exit(1);
}
#endif /* INTERVALS */
while (!times_up) {
#ifdef HISTOGRAM
/* timestamp just before our call to gethostbyname or */
/* gethostbyaddr, and then again just after the call. raj 7/97 */
gettimeofday(&time_one,NULL);
#endif /* HISTOGRAM */
/* until we implement the file, just request a fixed name. the */
/* file will include what we are to request, and an indication */
/* of whether or not it was supposed to "work" or "fail" at that */
/* point we will learn how to interpret the server's response */
/* raj 7/97 */
/* we use res_query because we may be looking for just about */
/* anything, and we do not want to be controlled in any way by */
/* the client's nsswitch file. */
if (res_query("hpindio.cup.hp.com",
class,
type,
server_response,
len) == -1) {
fprintf(where,
"send_dns_rr: res_query failed. errno %d\n",
errno);
fflush(where);
}
#ifdef HISTOGRAM
gettimeofday(&time_two,NULL);
HIST_add(time_hist,delta_micro(&time_one,&time_two));
#endif /* HISTOGRAM */
#ifdef INTERVALS
if (demo_mode) {
units_this_tick += 1;
}
/* in this case, the interval count is the count-down couter */
/* to decide to sleep for a little bit */
if ((interval_burst) && (--interval_count == 0)) {
/* call sigsuspend and wait for the interval timer to get us */
/* out */
if (debug) {
fprintf(where,"about to suspend\n");
fflush(where);
}
if (sigsuspend(&signal_set) == EFAULT) {
fprintf(where,
"send_udp_rr: fault with signal set!\n");
fflush(where);
exit(1);
}
interval_count = interval_burst;
}
#endif /* INTERVALS */
numtrans++;
if (debug > 3) {
if ((numtrans % 100) == 0) {
fprintf(where,
"Transaction %d completed\n",
numtrans);
fflush(where);
}
}
}
/* this call will always give us the elapsed time for the test, and */
/* will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time); /* was cpu being */
/* measured? how long */
/* did we really run? */
/* Get the statistics from the remote end. The remote will have */
/* calculated CPU utilization. If it wasn't supposed to care, it */
/* will return obvious values. */
recv_response();
if (!netperf_response.content.serv_errno) {
if (debug) {
fprintf(where,"remote results obtained\n");
fprintf(where,
"remote elapsed time %g\n",dns_rr_result->elapsed_time);
fprintf(where,
"remote cpu util %g\n",dns_rr_result->cpu_util);
fprintf(where,
"remote num cpu %g\n",dns_rr_result->num_cpus);
fflush(where);
}
}
else {
errno = netperf_response.content.serv_errno;
fprintf(where,"netperf: remote error %d",
netperf_response.content.serv_errno);
perror("");
fflush(where);
exit(1);
}
/* We now calculate what our throughput was for the test. */
thruput = numtrans/elapsed_time;
/* for this test, the remote CPU util is really the only */
/* interesting one - although I guess one can consider the local */
/* CPU util as giving an idea if the client saturated before the */
/* server */
if (local_cpu_usage || remote_cpu_usage) {
/* We must now do a little math for service demand and cpu */
/* utilization for the system(s) */
/* Of course, some of the information might be bogus because */
/* there was no idle counter in the kernel(s). We need to make */
/* a note of this for the user's benefit...*/
if (local_cpu_usage) {
local_cpu_utilization = calc_cpu_util(0.0);
/* since calc_service demand is doing ms/Kunit we will */
/* multiply the number of transaction by 1024 to get */
/* "good" numbers */
local_service_demand = calc_service_demand((double) numtrans*1024,
0.0,
0.0,
0);
}
else {
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
}
if (remote_cpu_usage) {
remote_cpu_utilization = dns_rr_result->cpu_util;
/* since calc_service demand is doing ms/Kunit we will */
/* multiply the number of transaction by 1024 to get */
/* "good" numbers */
remote_service_demand = calc_service_demand((double) numtrans*1024,
0.0,
remote_cpu_utilization,
dns_rr_result->num_cpus);
}
else {
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
}
else {
/* we were not measuring cpu, for the confidence stuff, we */
/* should make it -1.0 */
local_cpu_utilization = (float) -1.0;
local_service_demand = (float) -1.0;
remote_cpu_utilization = (float) -1.0;
remote_service_demand = (float) -1.0;
}
/* at this point, we want to calculate the confidence information. */
/* if debugging is on, calculate_confidence will print-out the */
/* parameters we pass it */
calculate_confidence(confidence_iteration,
elapsed_time,
thruput,
local_cpu_utilization,
remote_cpu_utilization,
local_service_demand,
remote_service_demand);
confidence_iteration++;
}
retrieve_confident_values(&elapsed_time,
&thruput,
&local_cpu_utilization,
&remote_cpu_utilization,
&local_service_demand,
&remote_service_demand);
/* We are now ready to print all the information. If the user */
/* has specified zero-level verbosity, we will just print the */
/* local service demand, or the remote service demand. If the */
/* user has requested verbosity level 1, he will get the basic */
/* "streamperf" numbers. If the user has specified a verbosity */
/* of greater than 1, we will display a veritable plethora of */
/* background information from outside of this block as it it */
/* not cpu_measurement specific... */
if (confidence < 0) {
/* we did not hit confidence, but were we asked to look for it? */
if (iteration_max > 1) {
display_confidence();
}
}
if (local_cpu_usage || remote_cpu_usage) {
local_cpu_method = format_cpu_method(cpu_method);
remote_cpu_method = format_cpu_method(dns_rr_result->cpu_method);
switch (verbosity) {
case 0:
if (local_cpu_usage) {
fprintf(where,
cpu_fmt_0,
local_service_demand,
local_cpu_method);
}
else {
fprintf(where,
cpu_fmt_0,
remote_service_demand,
remote_cpu_method);
}
break;
case 1:
case 2:
if (print_headers) {
fprintf(where,
cpu_title,
local_cpu_method,
remote_cpu_method);
}
fprintf(where,
cpu_fmt_1_line_1, /* the format string */
elapsed_time, /* how long was the test */
thruput,
local_cpu_utilization, /* local cpu */
remote_cpu_utilization, /* remote cpu */
local_service_demand, /* local service demand */
remote_service_demand); /* remote service demand */
break;
}
}
else {
/* The tester did not wish to measure service demand. */
switch (verbosity) {
case 0:
fprintf(where,
tput_fmt_0,
thruput);
break;
case 1:
case 2:
if (print_headers) {
fprintf(where,tput_title,format_units());
}
fprintf(where,
tput_fmt_1_line_1, /* the format string */
elapsed_time, /* how long did it take */
thruput);
break;
}
}
/* it would be a good thing to include information about some of the */
/* other parameters that may have been set for this test, but at the */
/* moment, I do not wish to figure-out all the formatting, so I will */
/* just put this comment here to help remind me that it is something */
/* that should be done at a later time. */
/* how to handle the verbose information in the presence of */
/* confidence intervals is yet to be determined... raj 11/94 */
if (verbosity > 1) {
#ifdef HISTOGRAM
fprintf(where,"\nHistogram of request/response times\n");
fflush(where);
HIST_report(time_hist);
#endif /* HISTOGRAM */
}
}
/* this routine implements the receive (netserver) side of a DNS_RR */
/* test */
void
recv_dns_rr()
{
int timed_out = 0;
float elapsed_time;
struct dns_rr_request_struct *dns_rr_request;
struct dns_rr_response_struct *dns_rr_response;
struct dns_rr_results_struct *dns_rr_results;
dns_rr_request =
(struct dns_rr_request_struct *)netperf_request.content.test_specific_data;
dns_rr_response =
(struct dns_rr_response_struct *)netperf_response.content.test_specific_data;
dns_rr_results =
(struct dns_rr_results_struct *)netperf_response.content.test_specific_data;
if (debug) {
fprintf(where,"netserver: recv_dns_rr: entered...\n");
fflush(where);
}
/* If anything goes wrong, we want the remote to know about it. It */
/* would be best if the error that the remote reports to the user is */
/* the actual error we encountered, rather than some bogus unexpected */
/* response type message. */
if (debug) {
fprintf(where,"recv_dns_rr: setting the response type...\n");
fflush(where);
}
netperf_response.content.response_type = DNS_RR_RESPONSE;
if (debug) {
fprintf(where,"recv_dns_rr: the response type is set...\n");
fflush(where);
}
netperf_response.content.serv_errno = 0;
/* But wait, there's more. If the initiator wanted cpu measurements, */
/* then we must call the calibrate routine, which will return the max */
/* rate back to the initiator. If the CPU was not to be measured, or */
/* something went wrong with the calibration, we will return a 0.0 to */
/* the initiator. */
dns_rr_response->cpu_rate = (float)0.0; /* assume no cpu */
dns_rr_response->measure_cpu = 0;
if (dns_rr_request->measure_cpu) {
dns_rr_response->measure_cpu = 1;
dns_rr_response->cpu_rate = calibrate_local_cpu(dns_rr_request->cpu_rate);
}
/* before we send the response back to the initiator, pull some of */
/* the socket parms from the globals */
dns_rr_response->test_length = dns_rr_request->test_length;
send_response();
/* the WIN32 stuff needs fleshing-out */
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
/* under us, which to date is the easiest/cleanest/least */
/* Windows-specific way I can find to force the winsock calls to */
/* return WSAEINTR with the test is over. anything that will run on */
/* 95 and NT and is closer to what netperf expects from Unix signals */
/* and such would be appreciated raj 1/96 */
win_kludge_socket = s_data;
#endif /* WIN32 */
if (debug) {
fprintf(where,"recv_dns_rr: initial response sent.\n");
fflush(where);
}
/* Now it's time to first grab the apropriate counters */
cpu_start(dns_rr_request->measure_cpu);
/* The loop will exit when we hit the end of the test time */
times_up = 0;
start_timer(dns_rr_request->test_length + PAD_TIME);
/* since we know that a signal will be coming, we use pause() here. */
/* using sleep leads to a premature exit that messes-up the CPU */
/* utilization figures. raj 7/97 */
pause();
/* The loop now exits due to timeout or transaction count being */
/* reached */
cpu_stop(dns_rr_request->measure_cpu,&elapsed_time);
stop_timer();
/* we ended the test by time, which was at least 2 seconds */
/* longer than we wanted to run. so, we want to subtract */
/* PAD_TIME from the elapsed_time. */
elapsed_time -= PAD_TIME;
/* send the results to the sender */
dns_rr_results->elapsed_time = elapsed_time;
dns_rr_results->cpu_method = cpu_method;
dns_rr_results->num_cpus = lib_num_loc_cpus;
if (dns_rr_request->measure_cpu) {
dns_rr_results->cpu_util = calc_cpu_util(elapsed_time);
}
if (debug) {
fprintf(where,
"recv_dns_rr: test complete, sending results.\n");
fflush(where);
}
send_response();
}
void
print_dns_usage()
{
printf("%s",dns_usage);
exit(1);
}
void
scan_dns_args(argc, argv)
int argc;
char *argv[];
{
#define DNS_ARGS "f:hH:"
extern char *optarg; /* pointer to option string */
int c;
char
arg1[BUFSIZ], /* argument holders */
arg2[BUFSIZ];
struct hostent *hp;
/* Go through all the command line arguments and break them */
/* out. For those options that take two parms, specifying only */
/* the first will set both to that value. Specifying only the */
/* second will leave the first untouched. To change only the */
/* first, use the form "first," (see the routine break_args.. */
while ((c= getopt(argc, argv, DNS_ARGS)) != EOF) {
switch (c) {
case '?':
case 'h':
print_dns_usage();
exit(1);
case 'f':
/* this is the name of the log file from which we pick what to */
/* request */
strcpy(request_file,optarg);
if (debug) {
fprintf(where,"Will take DNS names from %s\n",optarg);
fflush(where);
}
break;
case 'H':
/* someone wishes to specify the DNS server as being different */
/* from the endpoint of the control connection */
if ((dns_server_addr = inet_addr(optarg)) == -1) {
/* it was not an IP address, try it as a name, if it was */
/* all-ones broadcast, we don't want to send to that anyway */
if ((hp = gethostbyname(optarg)) == NULL) {
/* we have no idea what it is */
fprintf(where,
"scan_dns_args: could not resolve the DNS SUT %s\n",
optarg);
fflush(where);
exit(1);
}
else {
/* it was a valid remote_host. at some point, we really need */
/* to worry about IPv6 addresses and such, for now simply */
/* assume v4 and a four byte address */
bcopy(hp->h_addr,
(char *)&dns_server_addr,
4);
}
}
break;
};
}
}
#endif /* DO_DNS */

View File

@ -0,0 +1,48 @@
/*
Copyright (C) 1997, Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's DNS */
/* performance tests */
/* For the first iteration of this suite, netperf will rely on the */
/* gethostbyname() and gethostbyaddr() calls instead of making DNS */
/* calls directly. Later, when there is more time, this may be */
/* altered so that the netperf code is making the DNS requests */
/* directly, which would mean that more of the test could be */
/* controlled directly from netperf instead of indirectly through */
/* config files. */
/* In this suite, the netserver process really is not involved, it */
/* only measures CPU utilization over the test interval. Of course, */
/* this presumes that the netserver process will be running on the */
/* same machine as the DNS server :) raj 7/97 */
struct dns_rr_request_struct {
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
};
struct dns_rr_response_struct {
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
float cpu_rate; /* could we measure */
};
struct dns_rr_results_struct {
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
extern void scan_dns_args();
extern void send_dns_rr();
extern void recv_dns_rr();
extern void loc_cpu_rate();
extern void rem_cpu_rate();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,268 @@
/*
Copyright (C) 1993, Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's BSD */
/* sockets tests */
struct tcpipv6_stream_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
/* receive socket buffer that is */
int receive_size; /* how many bytes do we want to receive at one */
/* time? */
int recv_alignment; /* what is the alignment of the receive */
/* buffer? */
int recv_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
/* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
/* measured? */
float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
/* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the receive buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
};
struct tcpipv6_stream_response_struct {
int recv_buf_size; /* how big does the client want it */
int receive_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcpipv6_stream_results_struct {
double bytes_received;
unsigned int recv_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcpipv6_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcpipv6_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcpipv6_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct tcpipv6_conn_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcpipv6_conn_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcpipv6_conn_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */}
;
struct tcpipv6_tran_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct tcpipv6_tran_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct tcpipv6_tran_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct udpipv6_stream_request_struct {
int recv_buf_size;
int message_size;
int recv_alignment;
int recv_offset;
int checksum_off;
int measure_cpu;
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct udpipv6_stream_response_struct {
int recv_buf_size;
int send_buf_size;
int measure_cpu;
int test_length;
int data_port_number;
float cpu_rate;
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct udpipv6_stream_results_struct {
unsigned int messages_recvd;
unsigned int bytes_received;
float elapsed_time;
float cpu_util;
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
struct udpipv6_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
};
struct udpipv6_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct udpipv6_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs had the remote? */
};
extern void scan_sockets_args();
extern void send_tcpipv6_stream();
extern void send_tcpipv6_rr();
extern void send_tcpipv6_conn_rr();
extern void send_udpipv6_stream();
extern void send_udpipv6_rr();
extern void recv_tcpipv6_stream();
extern void recv_tcpipv6_rr();
extern void recv_tcpipv6_conn_rr();
extern void recv_udpipv6_stream();
extern void recv_udpipv6_rr();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,198 @@
/*
Copyright (C) 1993, Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's */
/* DLPI tests */
struct stream_stream_request_struct {
int recv_buf_size;
int send_buf_size;
int receive_size; /* how many bytes do we want to */
/* receive at one time? */
int recv_alignment; /* what is the alignment of the */
/* receive buffer? */
int recv_offset; /* and at what offset from that */
/* alignment? */
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int measure_cpu; /* does the client want server cpu */
/* utilization measured? */
float cpu_rate; /* do we know how fast the cpu is */
/* already? */
int test_length; /* how long is the test? */
int dirty_count; /* how many integers in the receive buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct stream_stream_response_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int receive_size;
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct stream_stream_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int num_cpus;
};
struct stream_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct stream_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
float cpu_rate; /* could we measure */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path to the dlpi device */
};
struct stream_rr_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int num_cpus;
};
struct dg_stream_request_struct {
int recv_buf_size;
int message_size;
int recv_alignment;
int recv_offset;
int measure_cpu;
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct dg_stream_response_struct {
int recv_buf_size;
int send_buf_size;
int measure_cpu;
int test_length;
float cpu_rate;
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct dg_stream_results_struct {
int messages_recvd;
int bytes_received;
float elapsed_time;
float cpu_util;
int num_cpus;
};
struct dg_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct dg_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
int path_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char unix_path[32]; /* the path */
};
struct dg_rr_results_struct {
int bytes_received; /* ignored initially */
int recv_calls; /* ignored initially */
int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int num_cpus;
};
extern void scan_unix_args();
extern void send_stream_stream();
extern void send_stream_rr();
extern void send_dg_stream();
extern void send_dg_rr();
extern void recv_stream_stream();
extern void recv_stream_rr();
extern void recv_dg_stream();
extern void recv_dg_rr();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,233 @@
/*
* Copyright (C) 1995 Hewlett-Packard Company
*/
/* This file contains the test-specific definitions for netperf's BSD */
/* sockets tests */
struct xti_tcp_stream_request_struct {
int send_buf_size;
int recv_buf_size; /* how big does the client want it - the */
/* receive socket buffer that is */
int receive_size; /* how many bytes do we want to receive at one */
/* time? */
int recv_alignment; /* what is the alignment of the receive */
/* buffer? */
int recv_offset; /* and at what offset from that alignment? */
int no_delay; /* do we disable the nagle algorithm for send */
/* coalescing? */
int measure_cpu; /* does the client want server cpu utilization */
/* measured? */
float cpu_rate; /* do we know how fast the cpu is already? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid copies on */
/* receives? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dirty_count; /* how many integers in the receive buffer */
/* should be made dirty before calling recv? */
int clean_count; /* how many integers should be read from the */
/* recv buffer before calling recv? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char xti_device[32]; /* the path to the dlpi device */
};
struct xti_tcp_stream_response_struct {
int recv_buf_size; /* how big does the client want it */
int receive_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct xti_tcp_stream_results_struct {
double bytes_received;
unsigned int recv_calls;
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs were there */
};
struct xti_tcp_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char xti_device[32]; /* the path to the dlpi device */
};
struct xti_tcp_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct xti_tcp_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs were there */
};
struct xti_tcp_conn_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char xti_device[32]; /* the path to the dlpi device */
};
struct xti_tcp_conn_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct xti_tcp_conn_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs were there */
};
struct xti_udp_stream_request_struct {
int recv_buf_size;
int message_size;
int recv_alignment;
int recv_offset;
int checksum_off; /* not used. left in for compatibility */
int measure_cpu;
float cpu_rate;
int test_length;
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char xti_device[32]; /* the path to the dlpi device */
};
struct xti_udp_stream_response_struct {
int recv_buf_size;
int send_buf_size;
int measure_cpu;
int test_length;
int data_port_number;
float cpu_rate;
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct xti_udp_stream_results_struct {
unsigned int messages_recvd;
unsigned int bytes_received;
float elapsed_time;
float cpu_util;
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs were there */
};
struct xti_udp_rr_request_struct {
int recv_buf_size; /* how big does the client want it */
int send_buf_size;
int recv_alignment;
int recv_offset;
int send_alignment;
int send_offset;
int request_size;
int response_size;
int no_delay;
int measure_cpu; /* does the client want server cpu */
float cpu_rate; /* do we know how fast the cpu is? */
int test_length; /* how long is the test? */
int so_rcvavoid; /* do we want the remote to avoid receive */
/* copies? */
int so_sndavoid; /* do we want the remote to avoid send copies? */
int dev_name_len; /* the length of the device name string. this */
/* is used to put it into the proper order on */
/* @#$% byte-swapped boxes... */
char xti_device[32]; /* the path to the dlpi device */
};
struct xti_udp_rr_response_struct {
int recv_buf_size; /* how big does the client want it */
int no_delay;
int measure_cpu; /* does the client want server cpu */
int test_length; /* how long is the test? */
int send_buf_size;
int data_port_number; /* connect to me here */
float cpu_rate; /* could we measure */
int so_rcvavoid; /* could the remote avoid receive copies? */
int so_sndavoid; /* could the remote avoid send copies? */
};
struct xti_udp_rr_results_struct {
unsigned int bytes_received; /* ignored initially */
unsigned int recv_calls; /* ignored initially */
unsigned int trans_received; /* not ignored */
float elapsed_time; /* how long the test ran */
float cpu_util; /* -1 if not measured */
float serv_dem; /* -1 if not measured */
int cpu_method; /* how was cpu util measured? */
int num_cpus; /* how many CPUs were there */
};

View File

@ -0,0 +1,163 @@
#!/bin/sh
#
# This script runs a series of netperf tests intended to gather the
# raw material necessary to arrive at estimates for the cost of
# sending and receiving a TCP segment, the cost of each additional byte
# and the cost of each incremental segment.
#
# there are a number of data points gathered by this script - it might
# run for a considerable length of time.
#
# rick jones 4/99
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> packet_byte_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> packet_byte_script hostname [CPU]"
exit 1
fi
# where is netperf
NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf}
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of NETPERF_PORT apropriately
# NETPERF_PORT="-p some_other_portnum"
NETPERF_PORT=${NETPERF_PORT:=""}
# The test length in seconds
NETPERF_TIME=${NETPERF_TIME:=20}
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
NETPERF_STATS=${NETPERF_STATS:="-i 10,3 -I 99,5"}
# The socket sizes that we will be testing - using zero will let it
# be the system default.
NETPERF_SKTS=${NETPERF_SKTS:="0"}
# The request,response sizes that we will be using. The netperf
# command parser will treat "1" the same as "1,1" - I use 1,1 to
# remember that it is "request,response"
NETPERF_REQS=${NETPERF_REQS:="1 16 32 64 128 256 512 1024 \
1460 1461 2920 2921 4380 4381"}
NETPERF_RESP=${NETPERF_RESP:="1 16 32 64 128 256 512 1024 \
1460 1461 2920 2921 4380 4381"}
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETPERF_CMD $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETPERF_CMD $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# This disables header display
NO_HDR="-P 0"
NO_HDR=""
for SOCKET_SIZE in $NETPERF_SKTS
do
echo
echo ------------------------------------------------------
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo
echo and these settings for send sizes $NETPERF_REQS
echo
for REQ in $NETPERF_REQS
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_RR $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-r ${REQ},1 -s $SOCKET_SIZE -S $SOCKET_SIZE
NO_HDR="-P 0"
done
echo
echo ------------------------------------------------------
NO_HDR=""
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo and these settings for response sizes $NETPERF_RESP
echo
for RESP in $NETPERF_RESP
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_RR $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-r 1,${RESP} -s $SOCKET_SIZE -S $SOCKET_SIZE
NO_HDR="-P 0"
done
echo
echo ------------------------------------------------------
NO_HDR=""
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo and these settings for response sizes $NETPERF_RESP
echo
for REQ in $NETPERF_REQS
do
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETPERF_CMD $PORT -l $NETPERF_TIME -H $REM_HOST $NO_HDR \
-t TCP_STREAM $LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-m ${REQ} -s $SOCKET_SIZE -S $SOCKET_SIZE -D
NO_HDR="-P 0"
done
done
# The test length in seconds for the CRR test, which needs to be
# longer for a connect/request/response test
NETPERF_CRR_TIME=${NETPERF_CRR_TIME:=120}
# now we do the TCP_CRR test
echo
echo ------------------------------------------------------
echo $NETPERF_CMD $NETPERF_PORT -l $NETPERF_CRR_TIME -H $REM_HOST -t TCP_CRR\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE
echo
$NETPERF_CMD $NETPERF_PORT -l $NETPERF_CRR_TIME -H $REM_HOST -t TCP_CRR\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $NETPERF_STATS --\
-s $SOCKET_SIZE -S $SOCKET_SIZE

View File

@ -0,0 +1,226 @@
#!/bin/sh
#set -x
#
# This is a script to generate a quick "snapshot" of performance for a
# pair of nodes. At first, it will perform the following tests:
#
# TCP Stream test with 56KB socket buffers and 4KB sends
# TCP Stream test with 32KB socket buffers and 4KB sends
# TCP Request/Response test with 1 byte requests and 1 byte responses
# UDP Request/Response test with 1 byte requests and 1 byte responses
# UDP Request/Response test with 516 byte requests and 4 byte responses
# UDP Stream test with 32KB socket buffers and 4KB sends
# UDP Stream test with 32KB socket buffers and 1KB sends
#
# All tests will run for sixty seconds. Confidence intervals are used
# to insure the repeatability of the test. This means that the soonest
# the script will be finished is 21 minutes.
#
# This script takes two parameters. The first parm is the name of the
# remote host. It is a required parameter. The second will either
# enable or disable CPU utilization measurements. It is an optional
# parameter which defaults to no CPU utilization measurements.
#
# usage: snapshot_script hostname [CPU]
#
# mod 6/29/95 - echo progress information to stderr so that we can
# see forward progress even when the results are
# re-directed to a file
#
# mod 5/27/96 - switch from NETHOME to NETPERF and take the user's value
# if it is already set
#
# mod 8/12/96 - fix the default netperf command variable so it finds the
# executable and not the directory...
#
# First, let us set-up some of the defaults
#
# where is netperf installed, there are a few possible places:
NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf}
# there should be no more than two parms passed
if [ $# -gt 2 ]; then
echo "try again, correctly -> snapshot_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> snapshot_script hostname [CPU]"
exit 1
fi
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actuall, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#NETPERF_PORT="-p some_other_portnum"
NETPERF_PORT=${NETPERF_PORT:=""}
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,3 -I 99,5"
# length in time of the test - should be 60 seconds
NETPERF_TIME=${NETPERF_TIME:=60}
# where is the bitbucket?
BITBUCKET="/dev/null"
# announce start of test
echo Netperf snapshot script started at `date` >&2
# If we are measuring CPU utilization, then we can save beaucoup time
# by saving the results of the CPU calibration and passing them in
# during the real tests. So, we execute the new CPU "tests" of netperf
# and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETPERF_CMD $NETPERF_PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETPERF_CMD $NETPERF_PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# We will perform three twenty second warm-up tests at this point, but
# we will not display the results of those tests. This is unlikely to
# make any difference in the results except right after a system
# reboot, but this is supposed to be rather "general." We will do a
# TCP stream and a TCP req/resp test
WARM_TIME="10"
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \
-s 32768 -S 32768 -m 4096 > ${BITBUCKET}
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_STREAM -H $REM_HOST -- \
-s 32768 -S 32768 -m 96 > ${BITBUCKET}
$NETPERF_CMD $NETPERF_PORT -l $WARM_TIME -t TCP_RR -H $REM_HOST -- \
-r 1,1 > ${BITBUCKET}
# The warm-ups are complete, so perform the real tests first, the
# stream tests, then the request/response
echo Starting 56x4 TCP_STREAM tests at `date` >&2
# a 56x4 TCP_STREAM test
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 57344 -S 57344 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 57344 -S 57344 -m 4096
echo
echo
# a 32x4 TCP_STREAM test
echo Starting 32x4 TCP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
echo
# a single-byte TCP_RR
echo Starting 1,1 TCP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
$NETPERF_CMD $NETPERF_PORT -t TCP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
echo
echo Starting 1,1 UDP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
# a single-byte UDP_RR
echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 1,1
echo
echo
# a UDP_RR test much like tftp
echo Starting 512,4 UDP_RR tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-r 516,4
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_RR -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- -r 516,4
# a 32x4 UDP_STREAM test
echo Starting 32x4 UDP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 4096
echo
echo
# a 32x1 UDP_STREAM test
echo Starting 32x1 UDP_STREAM tests at `date` >&2
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 1024
echo
$NETPERF_CMD $NETPERF_PORT -t UDP_STREAM -l $NETPERF_TIME -H $REM_HOST \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF -- \
-s 32768 -S 32768 -m 1024
echo
echo
# and that's that
echo Tests completed at `date` >&2
echo
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.

View File

@ -0,0 +1,113 @@
#!/bin/sh
#
# stream_range
#
# generate a whole lot of numbers from netperf to see the effects
# of send size on thruput
#
#
# usage : tcp_stream_range hostname [CPU]
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> tcp_stream_range hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> tcp_stream_range hostname [CPU]"
exit 1
fi
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#PORT="-p some_other_portnum"
PORT=""
# where is netperf, and are there any "constant" options such as
# the netserver port number
#NETHOME=/usr/etc/net_perf
NETHOME="."
NETPERF=$NETHOME/netperf $PORT
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,2 -I 99,3"
#
# some stuff for the arithmetic
#
# we start at start, and then multiply by MULT and add ADD. by changing
# these numbers, we can double each time, or increase by a fixed
# amount, or go up by 4x, whatever we like...
#
START=1
END=65536
MULT=4
ADD=0
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETPERF -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETPERF -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
TIME="60"
#
# the maximum socket buffer size is system dependent. for the
# "cannonical" tests we use 32KB, but this can be altered
#
SOCKET_SIZE="-s 32768 -S 32768"
MESSAGE=$START
while [ $MESSAGE -le $END ]; do
echo
echo ------------------------------------
echo Testing with the following command line:
echo $NETPERF -l $TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-m $MESSAGE $SOCKET_SIZE
echo
$NETPERF -l $TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-m $MESSAGE $SOCKET_SIZE
MESSAGE=`expr $MESSAGE + $ADD`
MESSAGE=`expr $MESSAGE \* $MULT`
done
echo
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.

View File

@ -0,0 +1,107 @@
#!/bin/sh
#
# This is an example script for using netperf. Feel free to modify it
# as necessary, but I would suggest that you copy this one first.
#
#
# This version has been modified to take advantage of the confidence
# interval support in revision 2.0 of netperf. it has also been altered
# to make submitting its resutls to the netperf database easier
# raj 11/94
#
# usage: tcp_rr_script hostname [CPU]
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> tcp_rr_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> tcp_rr_script hostname [CPU]"
exit 1
fi
# where the programs are
#NETHOME=/usr/local/netperf
#NETHOME="/opt/netperf"
NETHOME=.
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#PORT="-p some_other_portnum"
PORT=""
# The test length in seconds
TEST_TIME=60
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,3 -I 99,5"
# The socket sizes that we will be testing - using zero will let it
# be the system default.
SOCKET_SIZES="0"
# The request,response sizes that we will be using. The netperf
# command parser will treat "1" the same as "1,1" - I use 1,1 to
# remember that it is "request,response"
RR_SIZES="1,1 64,64 100,200 128,8192"
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# This disables header display
NO_HDR="-P 0"
for SOCKET_SIZE in $SOCKET_SIZES
do
for RR_SIZE in $RR_SIZES
do
echo
echo ------------------------------------------------------
echo Testing with the following command line:
# we echo the command line for cut and paste to th database
echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
echo
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_RR \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
done
done
echo
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.

View File

@ -0,0 +1,104 @@
#!/bin/sh
#
# This is an example script for using netperf. Feel free to modify it
# as necessary, but I would suggest that you copy this one first.
#
# This version has been modified to take advantage of the confidence
# interval support in revision 2.0 of netperf. it has also been altered
# to make submitting its resutls to the netperf database easier
# raj 11/94
#
# usage: tcp_stream_script hostname [CPU]
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> tcp_stream_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> tcp_stream_script hostname [CPU]"
exit 1
fi
# where the programs are
#NETHOME=/usr/local/netperf
#NETHOME="/opt/netperf"
NETHOME=.
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#PORT="-p some_other_portnum"
PORT=""
# The test length in seconds
TEST_TIME=60
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,2 -I 99,5"
# The socket sizes that we will be testing
SOCKET_SIZES="57344 32768 8192"
# The send sizes that we will be using
SEND_SIZES="4096 8192 32768"
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
REM_HOST=$1
fi
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# this will disable headers
NO_HDR="-P 0"
for SOCKET_SIZE in $SOCKET_SIZES
do
for SEND_SIZE in $SEND_SIZES
do
echo
echo ------------------------------------
echo
# we echo the command line for cut and paste
echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
echo
# since we have the confidence interval stuff, we do not
# need to repeat a test multiple times from the shell
$NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST -t TCP_STREAM\
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE $STATS_STUFF --\
-m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
done
done
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.

View File

@ -0,0 +1,107 @@
#!/bin/sh
#
# This is an example script for using netperf. Feel free to modify it
# as necessary, but I would suggest that you copy this one first.
#
#
# uncomment the next line if you think the script is broken
#set -x
if [ $# -gt 2 ]; then
echo "try again, correctly -> udp_rr_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> udp_rr_script hostname [CPU]"
exit 1
fi
# where the programs are
#NETHOME=/usr/local/netperf
#NETHOME="/opt/netperf"
NETHOME="."
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#PORT="-p some_other_portnum"
PORT=""
# The test length in seconds
TEST_TIME=60
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,2 -I 99,10"
# The socket sizes that we will be testing - 0 means use default
# not much point in changing the socket buffer for a UDP request/
# response test - unless you want to have requests/responses which
# are larger than the default
SOCKET_SIZES="0"
# The send sizes that we will be using
RR_SIZES="1,1 64,64 100,200 1024,1024"
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
LOC_CPU=""
REM_CPU=""
REM_HOST=$1
fi
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# This turns-off the display headers
NO_HDR="-P 0"
for SOCKET_SIZE in $SOCKET_SIZES
do
for RR_SIZE in $RR_SIZES
do
echo
echo ------------------------------------------------------
echo Testing with the following command line:
echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_RR --\
-r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
$NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_RR $NO_HDR --\
-r $RR_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
done
done
echo
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.

View File

@ -0,0 +1,104 @@
#!/bin/sh
#
# This is an example script for using netperf. Feel free to modify it
# as necessary, but I would suggest that you copy this one first.
# This script performs various UDP unidirectional stream tests.
#
if [ $# -gt 2 ]; then
echo "try again, correctly -> udp_stream_script hostname [CPU]"
exit 1
fi
if [ $# -eq 0 ]; then
echo "try again, correctly -> udp_stream_script hostname [CPU]"
exit 1
fi
# where the programs are
#NETHOME=/usr/local/netperf
#NETHOME="/opt/netperf"
NETHOME="."
# at what port will netserver be waiting? If you decide to run
# netserver at a differnet port than the default of 12865, then set
# the value of PORT apropriately
#PORT="-p some_other_portnum"
PORT=""
# The test length in seconds
TEST_TIME=60
# How accurate we want the estimate of performance:
# maximum and minimum test iterations (-i)
# confidence level (99 or 95) and interval (percent)
STATS_STUFF="-i 10,2 -I 99,10"
# The socket sizes that we will be testing. This should be a list of
# integers separated by spaces
SOCKET_SIZES="32768"
# The send sizes that we will be using. Using send sizes that result
# in UDP packets which are larger than link size can be a bad thing to do.
# for FDDI, you can tack-on a 4096 data point
SEND_SIZES="64 1024 1472"
# if there are two parms, parm one it the hostname and parm two will
# be a CPU indicator. actually, anything as a second parm will cause
# the CPU to be measured, but we will "advertise" it should be "CPU"
if [ $# -eq 2 ]; then
REM_HOST=$1
LOC_CPU="-c"
REM_CPU="-C"
fi
if [ $# -eq 1 ]; then
LOC_CPU=""
REM_CPU=""
REM_HOST=$1
fi
# If we are measuring CPU utilization, then we can save beaucoup
# time by saving the results of the CPU calibration and passing
# them in during the real tests. So, we execute the new CPU "tests"
# of netperf and put the values into shell vars.
case $LOC_CPU in
\-c) LOC_RATE=`$NETHOME/netperf $PORT -t LOC_CPU`;;
*) LOC_RATE=""
esac
case $REM_CPU in
\-C) REM_RATE=`$NETHOME/netperf $PORT -t REM_CPU -H $REM_HOST`;;
*) REM_RATE=""
esac
# This will tell netperf that headers are not to be displayed
NO_HDR="-P 0"
for SOCKET_SIZE in $SOCKET_SIZES
do
for SEND_SIZE in $SEND_SIZES
do
echo
echo ------------------------------------------------------
echo Testing with the following command line:
echo $NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_STREAM -- \
-m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
$NETHOME/netperf $PORT -l $TEST_TIME -H $REM_HOST $STATS_STUFF \
$LOC_CPU $LOC_RATE $REM_CPU $REM_RATE -t UDP_STREAM -- \
-m $SEND_SIZE -s $SOCKET_SIZE -S $SOCKET_SIZE
done
done
echo
echo If you wish to submit these results to the netperf database at
echo http://www.cup.hp.com/netperf/NetperfPage.html, please submit each
echo datapoint individually. Individual datapoints are separated by
echo lines of dashes.