├── INSTALL ├── LICENSE ├── Makefile ├── README.md ├── RELEASE_NOTES ├── aclocal.m4 ├── bootstrap.sh ├── config ├── ax_lib_socket_nsl.m4 ├── compile ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh ├── missing ├── mkinstalldirs └── test-driver ├── contrib ├── README.txt ├── iperf3.gp └── iperf3_to_gnuplot.py ├── docs ├── Makefile ├── _esnet │ ├── LICENSE │ ├── README.rst │ ├── deploy.sh │ ├── static │ │ ├── esnet.css │ │ ├── favicon.ico │ │ ├── icon-github.png │ │ ├── logo-esnet-ball-sm.png │ │ ├── logo-esnet-ball.png │ │ ├── logo-esnet-name.png │ │ └── logo-esnet.png │ └── templates │ │ ├── layout.html │ │ ├── navbar.html │ │ └── relations.html ├── building.rst ├── conf.py ├── dev.rst ├── index.rst ├── invoking.rst ├── news.rst └── obtaining.rst ├── examples ├── Makefile.am ├── Makefile.in ├── mic.c └── mis.c ├── iperf3.spec.in ├── src ├── ans_module.c ├── cjson.c ├── cjson.h ├── flowlabel.h ├── iperf.h ├── iperf3.1 ├── iperf_api.c ├── iperf_api.h ├── iperf_client_api.c ├── iperf_config.h ├── iperf_config.h.in ├── iperf_error.c ├── iperf_locale.c ├── iperf_locale.h ├── iperf_sctp.c ├── iperf_sctp.h ├── iperf_server_api.c ├── iperf_tcp.c ├── iperf_tcp.h ├── iperf_udp.c ├── iperf_udp.h ├── iperf_util.c ├── iperf_util.h ├── libiperf.3 ├── main.c ├── net.c ├── net.h ├── portable_endian.h ├── queue.h ├── t_timer.c ├── t_units.c ├── t_uuid.c ├── tcp_info.c ├── tcp_window_size.c ├── tcp_window_size.h ├── timer.c ├── timer.h ├── units.c ├── units.h ├── version.h └── version.h.in └── test_commands.sh /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free 5 | Software Foundation, Inc. 6 | 7 | This file is free documentation; the Free Software Foundation gives 8 | unlimited permission to copy, distribute and modify it. 9 | 10 | Basic Installation 11 | ================== 12 | 13 | These are generic installation instructions. 14 | 15 | The `configure' shell script attempts to guess correct values for 16 | various system-dependent variables used during compilation. It uses 17 | those values to create a `Makefile' in each directory of the package. 18 | It may also create one or more `.h' files containing system-dependent 19 | definitions. Finally, it creates a shell script `config.status' that 20 | you can run in the future to recreate the current configuration, and a 21 | file `config.log' containing compiler output (useful mainly for 22 | debugging `configure'). 23 | 24 | It can also use an optional file (typically called `config.cache' 25 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 26 | the results of its tests to speed up reconfiguring. (Caching is 27 | disabled by default to prevent problems with accidental use of stale 28 | cache files.) 29 | 30 | If you need to do unusual things to compile the package, please try 31 | to figure out how `configure' could check whether to do them, and mail 32 | diffs or instructions to the address given in the `README' so they can 33 | be considered for the next release. If you are using the cache, and at 34 | some point `config.cache' contains results you don't want to keep, you 35 | may remove or edit it. 36 | 37 | The file `configure.ac' (or `configure.in') is used to create 38 | `configure' by a program called `autoconf'. You only need 39 | `configure.ac' if you want to change it or regenerate `configure' using 40 | a newer version of `autoconf'. 41 | 42 | The simplest way to compile this package is: 43 | 44 | 1. `cd' to the directory containing the package's source code and type 45 | `./configure' to configure the package for your system. If you're 46 | using `csh' on an old version of System V, you might need to type 47 | `sh ./configure' instead to prevent `csh' from trying to execute 48 | `configure' itself. 49 | 50 | Running `configure' takes awhile. While running, it prints some 51 | messages telling which features it is checking for. 52 | 53 | 2. Type `make' to compile the package. 54 | 55 | 3. Optionally, type `make check' to run any self-tests that come with 56 | the package. 57 | 58 | 4. Type `make install' to install the programs and any data files and 59 | documentation. 60 | 61 | 5. You can remove the program binaries and object files from the 62 | source code directory by typing `make clean'. To also remove the 63 | files that `configure' created (so you can compile the package for 64 | a different kind of computer), type `make distclean'. There is 65 | also a `make maintainer-clean' target, but that is intended mainly 66 | for the package's developers. If you use it, you may have to get 67 | all sorts of other programs in order to regenerate files that came 68 | with the distribution. 69 | 70 | Compilers and Options 71 | ===================== 72 | 73 | Some systems require unusual options for compilation or linking that the 74 | `configure' script does not know about. Run `./configure --help' for 75 | details on some of the pertinent environment variables. 76 | 77 | You can give `configure' initial values for configuration parameters 78 | by setting variables in the command line or in the environment. Here 79 | is an example: 80 | 81 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 82 | 83 | *Note Defining Variables::, for more details. 84 | 85 | Compiling For Multiple Architectures 86 | ==================================== 87 | 88 | You can compile the package for more than one kind of computer at the 89 | same time, by placing the object files for each architecture in their 90 | own directory. To do this, you must use a version of `make' that 91 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 92 | directory where you want the object files and executables to go and run 93 | the `configure' script. `configure' automatically checks for the 94 | source code in the directory that `configure' is in and in `..'. 95 | 96 | If you have to use a `make' that does not support the `VPATH' 97 | variable, you have to compile the package for one architecture at a 98 | time in the source code directory. After you have installed the 99 | package for one architecture, use `make distclean' before reconfiguring 100 | for another architecture. 101 | 102 | Installation Names 103 | ================== 104 | 105 | By default, `make install' installs the package's commands under 106 | `/usr/local/bin', include files under `/usr/local/include', etc. You 107 | can specify an installation prefix other than `/usr/local' by giving 108 | `configure' the option `--prefix=PREFIX'. 109 | 110 | You can specify separate installation prefixes for 111 | architecture-specific files and architecture-independent files. If you 112 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 113 | PREFIX as the prefix for installing programs and libraries. 114 | Documentation and other data files still use the regular prefix. 115 | 116 | In addition, if you use an unusual directory layout you can give 117 | options like `--bindir=DIR' to specify different values for particular 118 | kinds of files. Run `configure --help' for a list of the directories 119 | you can set and what kinds of files go in them. 120 | 121 | If the package supports it, you can cause programs to be installed 122 | with an extra prefix or suffix on their names by giving `configure' the 123 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 124 | 125 | Optional Features 126 | ================= 127 | 128 | Some packages pay attention to `--enable-FEATURE' options to 129 | `configure', where FEATURE indicates an optional part of the package. 130 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 131 | is something like `gnu-as' or `x' (for the X Window System). The 132 | `README' should mention any `--enable-' and `--with-' options that the 133 | package recognizes. 134 | 135 | For packages that use the X Window System, `configure' can usually 136 | find the X include and library files automatically, but if it doesn't, 137 | you can use the `configure' options `--x-includes=DIR' and 138 | `--x-libraries=DIR' to specify their locations. 139 | 140 | Specifying the System Type 141 | ========================== 142 | 143 | There may be some features `configure' cannot figure out automatically, 144 | but needs to determine by the type of machine the package will run on. 145 | Usually, assuming the package is built to be run on the _same_ 146 | architectures, `configure' can figure that out, but if it prints a 147 | message saying it cannot guess the machine type, give it the 148 | `--build=TYPE' option. TYPE can either be a short name for the system 149 | type, such as `sun4', or a canonical name which has the form: 150 | 151 | CPU-COMPANY-SYSTEM 152 | 153 | where SYSTEM can have one of these forms: 154 | 155 | OS KERNEL-OS 156 | 157 | See the file `config.sub' for the possible values of each field. If 158 | `config.sub' isn't included in this package, then this package doesn't 159 | need to know the machine type. 160 | 161 | If you are _building_ compiler tools for cross-compiling, you should 162 | use the option `--target=TYPE' to select the type of system they will 163 | produce code for. 164 | 165 | If you want to _use_ a cross compiler, that generates code for a 166 | platform different from the build platform, you should specify the 167 | "host" platform (i.e., that on which the generated programs will 168 | eventually be run) with `--host=TYPE'. 169 | 170 | Sharing Defaults 171 | ================ 172 | 173 | If you want to set default values for `configure' scripts to share, you 174 | can create a site shell script called `config.site' that gives default 175 | values for variables like `CC', `cache_file', and `prefix'. 176 | `configure' looks for `PREFIX/share/config.site' if it exists, then 177 | `PREFIX/etc/config.site' if it exists. Or, you can set the 178 | `CONFIG_SITE' environment variable to the location of the site script. 179 | A warning: not all `configure' scripts look for a site script. 180 | 181 | Defining Variables 182 | ================== 183 | 184 | Variables not defined in a site shell script can be set in the 185 | environment passed to `configure'. However, some packages may run 186 | configure again during the build, and the customized values of these 187 | variables may be lost. In order to avoid this problem, you should set 188 | them in the `configure' command line, using `VAR=value'. For example: 189 | 190 | ./configure CC=/usr/local2/bin/gcc 191 | 192 | causes the specified `gcc' to be used as the C compiler (unless it is 193 | overridden in the site shell script). Here is a another example: 194 | 195 | /bin/bash ./configure CONFIG_SHELL=/bin/bash 196 | 197 | Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent 198 | configuration-related scripts to be executed by `/bin/bash'. 199 | 200 | `configure' Invocation 201 | ====================== 202 | 203 | `configure' recognizes the following options to control how it operates. 204 | 205 | `--help' 206 | `-h' 207 | Print a summary of the options to `configure', and exit. 208 | 209 | `--version' 210 | `-V' 211 | Print the version of Autoconf used to generate the `configure' 212 | script, and exit. 213 | 214 | `--cache-file=FILE' 215 | Enable the cache: use and save the results of the tests in FILE, 216 | traditionally `config.cache'. FILE defaults to `/dev/null' to 217 | disable caching. 218 | 219 | `--config-cache' 220 | `-C' 221 | Alias for `--cache-file=config.cache'. 222 | 223 | `--quiet' 224 | `--silent' 225 | `-q' 226 | Do not print messages saying which checks are being made. To 227 | suppress all normal output, redirect it to `/dev/null' (any error 228 | messages will still be shown). 229 | 230 | `--srcdir=DIR' 231 | Look for the package's source code in directory DIR. Usually 232 | `configure' can determine that directory automatically. 233 | 234 | `configure' also accepts some other, not widely useful, options. Run 235 | `configure --help' for more details. 236 | 237 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | # iperf, Copyright (c) 2014, 2016, The Regents of the University of 3 | # California, through Lawrence Berkeley National Laboratory (subject 4 | # to receipt of any required approvals from the U.S. Dept. of 5 | # Energy). All rights reserved. 6 | # 7 | # If you have questions about your rights to use or distribute this 8 | # software, please contact Berkeley Lab's Technology Transfer 9 | # Department at TTD@lbl.gov. 10 | # 11 | # NOTICE. This software is owned by the U.S. Department of Energy. 12 | # As such, the U.S. Government has been granted for itself and others 13 | # acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | # worldwide license in the Software to reproduce, prepare derivative 15 | # works, and perform publicly and display publicly. Beginning five 16 | # (5) years after the date permission to assert copyright is obtained 17 | # from the U.S. Department of Energy, and subject to any subsequent 18 | # five (5) year renewals, the U.S. Government is granted for itself 19 | # and others acting on its behalf a paid-up, nonexclusive, 20 | # irrevocable, worldwide license in the Software to reproduce, 21 | # prepare derivative works, distribute copies to the public, perform 22 | # publicly and display publicly, and to permit others to do so. 23 | # 24 | # This code is distributed under a BSD style license, see the LICENSE 25 | # file for complete information. 26 | 27 | CC = gcc 28 | RM = rm -f 29 | 30 | DPDK_CFLAGS += -O3 \ 31 | -I$(RTE_ANS)/librte_ans/include \ 32 | -I$(RTE_ANS)/librte_anssock/include 33 | 34 | DPDK_LDLIBS += $(RTE_ANS)/librte_anssock/librte_anssock.a \ 35 | -L$(RTE_SDK)/$(RTE_TARGET)/lib \ 36 | -Wl,--whole-archive -Wl,-lrte_mbuf -Wl,-lrte_mempool_ring -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-lrte_kvargs -Wl,--no-whole-archive -Wl,-export-dynamic -lnuma\ 37 | -lrt -pthread -ldl 38 | 39 | DPDK_OBJS = ./src/cjson.dpdk.o ./src/iperf_client_api.dpdk.o \ 40 | ./src/iperf_locale.dpdk.o ./src/iperf_server_api.dpdk.o \ 41 | ./src/iperf_udp.dpdk.o ./src/main.dpdk.o \ 42 | ./src/tcp_info.dpdk.o ./src/timer.dpdk.o \ 43 | ./src/units.dpdk.o ./src/iperf_api.dpdk.o \ 44 | ./src/iperf_error.dpdk.o ./src/iperf_tcp.dpdk.o \ 45 | ./src/iperf_util.dpdk.o ./src/net.dpdk.o \ 46 | ./src/tcp_window_size.dpdk.o ./src/ans_module.dpdk.o 47 | 48 | ORIG_OBJS = ./src/cjson.o ./src/iperf_client_api.o \ 49 | ./src/iperf_locale.o ./src/iperf_server_api.o \ 50 | ./src/iperf_udp.o ./src/main.o \ 51 | ./src/tcp_info.o ./src/timer.o \ 52 | ./src/units.o ./src/iperf_api.o \ 53 | ./src/iperf_error.o ./src/iperf_tcp.o \ 54 | ./src/iperf_util.o ./src/net.o \ 55 | ./src/tcp_window_size.o 56 | 57 | DPDK_TARGET = dpdk_iperf3 58 | ORIG_TARGET = iperf3 59 | 60 | $(DPDK_TARGET):$(DPDK_OBJS) 61 | $(CC) -o $(DPDK_TARGET) $(DPDK_OBJS) $(DPDK_CFLAGS) $(DPDK_LDLIBS) 62 | 63 | $(ORIG_TARGET):$(ORIG_OBJS) 64 | $(CC) -o $(ORIG_TARGET) $(ORIG_OBJS) 65 | 66 | $(DPDK_OBJS):%.dpdk.o:%.c 67 | $(CC) -D_HAVE_DPDK_ANS_ -c $(DPDK_CFLAGS) $< -o $@ 68 | 69 | $(OBJS):%.o:%.c 70 | $(CC) -c $< -o $@ 71 | 72 | all: $(DPDK_TARGET) $(ORIG_TARGET) 73 | 74 | dpdk-iperf: $(DPDK_TARGET) 75 | 76 | iperf: $(ORIG_TARGET) 77 | 78 | clean: 79 | -$(RM) $(DPDK_TARGET) $(DPDK_OBJS) 80 | -$(RM) $(ORIG_TARGET) $(ORIG_OBJS) 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### dpdk-iperf 2 | -------------- 3 | Fork from official iperf-3.1.3, and run on the dpdk user space TCP/IP stack(ANS). 4 | 5 | #### Build and Install 6 | -------------- 7 | * Download latest dpdk version from [dpdk website](http://dpdk.org/), and build dpdk 8 | ``` 9 | $ make config T=x86_64-native-linuxapp-gcc 10 | $ make install T=x86_64-native-linuxapp-gcc 11 | $ export RTE_SDK=/home/mytest/dpdk 12 | $ export RTE_TARGET=x86_64-native-linuxapp-gcc 13 | ``` 14 | * Download ANS following the [ANS wiki](https://github.com/opendp/dpdk-ans/wiki/Compile-APP-with-ans), buld ans and startup ans 15 | ``` 16 | $ git clone https://github.com/ansyun/dpdk-ans.git 17 | $ export RTE_ANS=/home/mytest/dpdk-ans 18 | $ ./install_deps.sh 19 | $ cd ans 20 | $ make 21 | $ sudo ./build/ans -c 0x2 -n 1 -- -p 0x1 --config="(0,0,1)" 22 | EAL: Detected lcore 0 as core 0 on socket 0 23 | EAL: Detected lcore 1 as core 1 on socket 0 24 | EAL: Support maximum 128 logical core(s) by configuration. 25 | EAL: Detected 2 lcore(s) 26 | EAL: VFIO modules not all loaded, skip VFIO support... 27 | EAL: Setting up physically contiguous memory... 28 | EAL: Ask a virtual area of 0x400000 bytes 29 | EAL: Virtual area found at 0x7fdf90c00000 (size = 0x400000) 30 | EAL: Ask a virtual area of 0x15400000 bytes 31 | ``` 32 | * Download dpdk-iperf and build dpdk-iperf3/iperf3 33 | ``` 34 | $ git clone https://github.com/ansyun/dpdk-iperf.git 35 | dpdk-iperf3 process run on ANS tcp/ip stack. 36 | iperf3 process run on linux kernel tcp/ip stack. 37 | 38 | You may one of below command to compile dpdk-iperf 39 | $ make all // make dpdk-iperf3 and iperf3 40 | $ make dpdk-iperf // make dpdk-iperf3 41 | $ make iperf // make iperf3 42 | 43 | ``` 44 | 45 | * run dpdk-iperf3 on ans side 46 | ``` 47 | /dpdk-iperf# ./dpdk_iperf3 -s --bind 10.0.0.2 48 | EAL: Detected 40 lcore(s) 49 | EAL: Detected 2 NUMA nodes 50 | EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_39587_4958d65583aec4 51 | EAL: Probing VFIO support... 52 | USER8: LCORE[-1] anssock any lcore id 0xffffffff 53 | USER8: LCORE[10] anssock app id: 39587 54 | USER8: LCORE[10] anssock app name: dpdk_iperf3 55 | USER8: LCORE[10] anssock app lcoreId: 10 56 | USER8: LCORE[10] mp ops number 4, mp ops index: 0 57 | USER8: LCORE[10] setsockopt: not support optname 2 58 | ----------------------------------------------------------- 59 | Server listening on 5201 60 | ----------------------------------------------------------- 61 | fcntl(F_GETFL): Bad file descriptor 62 | Accepted connection from ::2300:0:0:0, port 44544 63 | An unknown state was sent by the client, ignoring it. 64 | fcntl(F_GETFL): Bad file descriptor 65 | [2036] local :: port 5201 connected to :: port 44546 66 | [ ID] Interval Transfer Bandwidth 67 | [2036] 0.00-1.00 sec 1.05 GBytes 9.03 Gbits/sec 68 | [2036] 1.00-2.00 sec 1.10 GBytes 9.41 Gbits/sec 69 | [2036] 2.00-3.00 sec 1.10 GBytes 9.41 Gbits/sec 70 | [2036] 3.00-4.00 sec 1.10 GBytes 9.41 Gbits/sec 71 | [2036] 4.00-5.00 sec 1.10 GBytes 9.41 Gbits/sec 72 | [2036] 5.00-6.00 sec 1.10 GBytes 9.41 Gbits/sec 73 | [2036] 6.00-7.00 sec 1.10 GBytes 9.41 Gbits/sec 74 | [2036] 7.00-8.00 sec 1.10 GBytes 9.41 Gbits/sec 75 | [2036] 8.00-9.00 sec 1.10 GBytes 9.41 Gbits/sec 76 | [2036] 9.00-10.00 sec 1.10 GBytes 9.41 Gbits/sec 77 | [2036] 10.00-10.04 sec 40.9 MBytes 9.41 Gbits/sec 78 | - - - - - - - - - - - - - - - - - - - - - - - - - 79 | [ ID] Interval Transfer Bandwidth 80 | [2036] 0.00-10.04 sec 0.00 Bytes 0.00 bits/sec sender 81 | [2036] 0.00-10.04 sec 11.0 GBytes 9.38 Gbits/sec receiver 82 | An unknown state was sent by the client, ignoring it. 83 | USER8: LCORE[10] setsockopt: not support optname 2 84 | ----------------------------------------------------------- 85 | Server listening on 5201 86 | ----------------------------------------------------------- 87 | ``` 88 | * run iperf3 on linux side 89 | ``` 90 | /dpdk-iperf# ./iperf3 -c 10.0.0.2 91 | Connecting to host 10.0.0.2, port 5201 92 | [ 5] local 10.0.0.10 port 44546 connected to 10.0.0.2 port 5201 93 | [ ID] Interval Transfer Bandwidth Retr Cwnd 94 | [ 5] 0.00-1.00 sec 1.09 GBytes 9.39 Gbits/sec 0 694 KBytes 95 | [ 5] 1.00-2.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 96 | [ 5] 2.00-3.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 97 | [ 5] 3.00-4.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 98 | [ 5] 4.00-5.00 sec 1.09 GBytes 9.41 Gbits/sec 0 694 KBytes 99 | [ 5] 5.00-6.00 sec 1.10 GBytes 9.42 Gbits/sec 0 694 KBytes 100 | [ 5] 6.00-7.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 101 | [ 5] 7.00-8.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 102 | [ 5] 8.00-9.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 103 | An unknown state was sent by the client, ignoring it. 104 | [ 5] 9.00-10.00 sec 1.10 GBytes 9.41 Gbits/sec 0 694 KBytes 105 | - - - - - - - - - - - - - - - - - - - - - - - - - 106 | [ ID] Interval Transfer Bandwidth Retr 107 | [ 5] 0.00-10.00 sec 11.0 GBytes 9.41 Gbits/sec 0 sender 108 | [ 5] 0.00-10.00 sec 11.0 GBytes 9.41 Gbits/sec receiver 109 | 110 | iperf Done. 111 | 112 | ``` 113 | #### Notes 114 | ------- 115 | - If you want to use linux iperf3 connect to dpdk-iperf3, the linux iperf3 shall be complied from dpdk-iperf project, not the open source on other website. 116 | 117 | #### Support 118 | ------- 119 | For free support, please use ans team mail list at anssupport@163.com, or QQ Group:86883521, or https://dpdk-ans.slack.com. 120 | 121 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # iperf, Copyright (c) 2014, The Regents of the University of 4 | # California, through Lawrence Berkeley National Laboratory (subject 5 | # to receipt of any required approvals from the U.S. Dept. of 6 | # Energy). All rights reserved. 7 | # 8 | # If you have questions about your rights to use or distribute this 9 | # software, please contact Berkeley Lab's Technology Transfer 10 | # Department at TTD@lbl.gov. 11 | # 12 | # NOTICE. This software is owned by the U.S. Department of Energy. 13 | # As such, the U.S. Government has been granted for itself and others 14 | # acting on its behalf a paid-up, nonexclusive, irrevocable, 15 | # worldwide license in the Software to reproduce, prepare derivative 16 | # works, and perform publicly and display publicly. Beginning five 17 | # (5) years after the date permission to assert copyright is obtained 18 | # from the U.S. Department of Energy, and subject to any subsequent 19 | # five (5) year renewals, the U.S. Government is granted for itself 20 | # and others acting on its behalf a paid-up, nonexclusive, 21 | # irrevocable, worldwide license in the Software to reproduce, 22 | # prepare derivative works, distribute copies to the public, perform 23 | # publicly and display publicly, and to permit others to do so. 24 | # 25 | # This code is distributed under a BSD style license, see the LICENSE 26 | # file for complete information. 27 | # 28 | 29 | # When changes are made to the build infrastructure, invoke this 30 | # script to regenerate all of the autotools-built files. 31 | # Normally, this is only of use to developers. 32 | 33 | # Figure out how to invoke libtoolize. On MacOS (with MacPorts) 34 | # it's invoked as glibtoolize. 35 | if libtoolize --version >/dev/null 2>&1; then 36 | libtoolize=libtoolize 37 | elif glibtoolize --version >/dev/null 2>&1; then 38 | libtoolize=glibtoolize 39 | else 40 | libtoolize="" 41 | fi 42 | if [ "x$libtoolize" = "x" ]; then 43 | echo "Can't find libtoolize, exiting." 44 | exit 1 45 | fi 46 | 47 | # Execute the various autotools commands in the correct order. 48 | set -x 49 | $libtoolize --copy --force --automake 50 | aclocal -I config 51 | autoheader 52 | automake --foreign --add-missing --copy 53 | autoconf 54 | rm -rf config.cache 55 | -------------------------------------------------------------------------------- /config/ax_lib_socket_nsl.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_LIB_SOCKET_NSL 8 | # 9 | # DESCRIPTION 10 | # 11 | # This macro figures out what libraries are required on this platform to 12 | # link sockets programs. 13 | # 14 | # The common cases are not to need any extra libraries, or to need 15 | # -lsocket and -lnsl. We need to avoid linking with libnsl unless we need 16 | # it, though, since on some OSes where it isn't necessary it will totally 17 | # break networking. Unisys also includes gethostbyname() in libsocket but 18 | # needs libnsl for socket(). 19 | # 20 | # LICENSE 21 | # 22 | # Copyright (c) 2008 Russ Allbery 23 | # Copyright (c) 2008 Stepan Kasal 24 | # Copyright (c) 2008 Warren Young 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 6 32 | 33 | AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL]) 34 | AC_DEFUN([AX_LIB_SOCKET_NSL], 35 | [ 36 | AC_SEARCH_LIBS([gethostbyname], [nsl]) 37 | AC_SEARCH_LIBS([socket], [socket], [], [ 38 | AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], 39 | [], [-lnsl])]) 40 | ]) 41 | -------------------------------------------------------------------------------- /config/compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Wrapper for compilers which do not understand '-c -o'. 3 | 4 | scriptversion=2012-10-14.11; # UTC 5 | 6 | # Copyright (C) 1999-2014 Free Software Foundation, Inc. 7 | # Written by Tom Tromey . 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # This file is maintained in Automake, please report 28 | # bugs to or send patches to 29 | # . 30 | 31 | nl=' 32 | ' 33 | 34 | # We need space, tab and new line, in precisely that order. Quoting is 35 | # there to prevent tools from complaining about whitespace usage. 36 | IFS=" "" $nl" 37 | 38 | file_conv= 39 | 40 | # func_file_conv build_file lazy 41 | # Convert a $build file to $host form and store it in $file 42 | # Currently only supports Windows hosts. If the determined conversion 43 | # type is listed in (the comma separated) LAZY, no conversion will 44 | # take place. 45 | func_file_conv () 46 | { 47 | file=$1 48 | case $file in 49 | / | /[!/]*) # absolute file, and not a UNC file 50 | if test -z "$file_conv"; then 51 | # lazily determine how to convert abs files 52 | case `uname -s` in 53 | MINGW*) 54 | file_conv=mingw 55 | ;; 56 | CYGWIN*) 57 | file_conv=cygwin 58 | ;; 59 | *) 60 | file_conv=wine 61 | ;; 62 | esac 63 | fi 64 | case $file_conv/,$2, in 65 | *,$file_conv,*) 66 | ;; 67 | mingw/*) 68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` 69 | ;; 70 | cygwin/*) 71 | file=`cygpath -m "$file" || echo "$file"` 72 | ;; 73 | wine/*) 74 | file=`winepath -w "$file" || echo "$file"` 75 | ;; 76 | esac 77 | ;; 78 | esac 79 | } 80 | 81 | # func_cl_dashL linkdir 82 | # Make cl look for libraries in LINKDIR 83 | func_cl_dashL () 84 | { 85 | func_file_conv "$1" 86 | if test -z "$lib_path"; then 87 | lib_path=$file 88 | else 89 | lib_path="$lib_path;$file" 90 | fi 91 | linker_opts="$linker_opts -LIBPATH:$file" 92 | } 93 | 94 | # func_cl_dashl library 95 | # Do a library search-path lookup for cl 96 | func_cl_dashl () 97 | { 98 | lib=$1 99 | found=no 100 | save_IFS=$IFS 101 | IFS=';' 102 | for dir in $lib_path $LIB 103 | do 104 | IFS=$save_IFS 105 | if $shared && test -f "$dir/$lib.dll.lib"; then 106 | found=yes 107 | lib=$dir/$lib.dll.lib 108 | break 109 | fi 110 | if test -f "$dir/$lib.lib"; then 111 | found=yes 112 | lib=$dir/$lib.lib 113 | break 114 | fi 115 | if test -f "$dir/lib$lib.a"; then 116 | found=yes 117 | lib=$dir/lib$lib.a 118 | break 119 | fi 120 | done 121 | IFS=$save_IFS 122 | 123 | if test "$found" != yes; then 124 | lib=$lib.lib 125 | fi 126 | } 127 | 128 | # func_cl_wrapper cl arg... 129 | # Adjust compile command to suit cl 130 | func_cl_wrapper () 131 | { 132 | # Assume a capable shell 133 | lib_path= 134 | shared=: 135 | linker_opts= 136 | for arg 137 | do 138 | if test -n "$eat"; then 139 | eat= 140 | else 141 | case $1 in 142 | -o) 143 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 144 | eat=1 145 | case $2 in 146 | *.o | *.[oO][bB][jJ]) 147 | func_file_conv "$2" 148 | set x "$@" -Fo"$file" 149 | shift 150 | ;; 151 | *) 152 | func_file_conv "$2" 153 | set x "$@" -Fe"$file" 154 | shift 155 | ;; 156 | esac 157 | ;; 158 | -I) 159 | eat=1 160 | func_file_conv "$2" mingw 161 | set x "$@" -I"$file" 162 | shift 163 | ;; 164 | -I*) 165 | func_file_conv "${1#-I}" mingw 166 | set x "$@" -I"$file" 167 | shift 168 | ;; 169 | -l) 170 | eat=1 171 | func_cl_dashl "$2" 172 | set x "$@" "$lib" 173 | shift 174 | ;; 175 | -l*) 176 | func_cl_dashl "${1#-l}" 177 | set x "$@" "$lib" 178 | shift 179 | ;; 180 | -L) 181 | eat=1 182 | func_cl_dashL "$2" 183 | ;; 184 | -L*) 185 | func_cl_dashL "${1#-L}" 186 | ;; 187 | -static) 188 | shared=false 189 | ;; 190 | -Wl,*) 191 | arg=${1#-Wl,} 192 | save_ifs="$IFS"; IFS=',' 193 | for flag in $arg; do 194 | IFS="$save_ifs" 195 | linker_opts="$linker_opts $flag" 196 | done 197 | IFS="$save_ifs" 198 | ;; 199 | -Xlinker) 200 | eat=1 201 | linker_opts="$linker_opts $2" 202 | ;; 203 | -*) 204 | set x "$@" "$1" 205 | shift 206 | ;; 207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) 208 | func_file_conv "$1" 209 | set x "$@" -Tp"$file" 210 | shift 211 | ;; 212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) 213 | func_file_conv "$1" mingw 214 | set x "$@" "$file" 215 | shift 216 | ;; 217 | *) 218 | set x "$@" "$1" 219 | shift 220 | ;; 221 | esac 222 | fi 223 | shift 224 | done 225 | if test -n "$linker_opts"; then 226 | linker_opts="-link$linker_opts" 227 | fi 228 | exec "$@" $linker_opts 229 | exit 1 230 | } 231 | 232 | eat= 233 | 234 | case $1 in 235 | '') 236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2 237 | exit 1; 238 | ;; 239 | -h | --h*) 240 | cat <<\EOF 241 | Usage: compile [--help] [--version] PROGRAM [ARGS] 242 | 243 | Wrapper for compilers which do not understand '-c -o'. 244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining 245 | arguments, and rename the output as expected. 246 | 247 | If you are trying to build a whole package this is not the 248 | right script to run: please start by reading the file 'INSTALL'. 249 | 250 | Report bugs to . 251 | EOF 252 | exit $? 253 | ;; 254 | -v | --v*) 255 | echo "compile $scriptversion" 256 | exit $? 257 | ;; 258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) 259 | func_cl_wrapper "$@" # Doesn't return... 260 | ;; 261 | esac 262 | 263 | ofile= 264 | cfile= 265 | 266 | for arg 267 | do 268 | if test -n "$eat"; then 269 | eat= 270 | else 271 | case $1 in 272 | -o) 273 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 274 | # So we strip '-o arg' only if arg is an object. 275 | eat=1 276 | case $2 in 277 | *.o | *.obj) 278 | ofile=$2 279 | ;; 280 | *) 281 | set x "$@" -o "$2" 282 | shift 283 | ;; 284 | esac 285 | ;; 286 | *.c) 287 | cfile=$1 288 | set x "$@" "$1" 289 | shift 290 | ;; 291 | *) 292 | set x "$@" "$1" 293 | shift 294 | ;; 295 | esac 296 | fi 297 | shift 298 | done 299 | 300 | if test -z "$ofile" || test -z "$cfile"; then 301 | # If no '-o' option was seen then we might have been invoked from a 302 | # pattern rule where we don't need one. That is ok -- this is a 303 | # normal compilation that the losing compiler can handle. If no 304 | # '.c' file was seen then we are probably linking. That is also 305 | # ok. 306 | exec "$@" 307 | fi 308 | 309 | # Name of file we expect compiler to create. 310 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` 311 | 312 | # Create the lock directory. 313 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name 314 | # that we are using for the .o file. Also, base the name on the expected 315 | # object file name, since that is what matters with a parallel build. 316 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d 317 | while true; do 318 | if mkdir "$lockdir" >/dev/null 2>&1; then 319 | break 320 | fi 321 | sleep 1 322 | done 323 | # FIXME: race condition here if user kills between mkdir and trap. 324 | trap "rmdir '$lockdir'; exit 1" 1 2 15 325 | 326 | # Run the compile. 327 | "$@" 328 | ret=$? 329 | 330 | if test -f "$cofile"; then 331 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile" 332 | elif test -f "${cofile}bj"; then 333 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" 334 | fi 335 | 336 | rmdir "$lockdir" 337 | exit $ret 338 | 339 | # Local Variables: 340 | # mode: shell-script 341 | # sh-indentation: 2 342 | # eval: (add-hook 'write-file-hooks 'time-stamp) 343 | # time-stamp-start: "scriptversion=" 344 | # time-stamp-format: "%:y-%02m-%02d.%02H" 345 | # time-stamp-time-zone: "UTC" 346 | # time-stamp-end: "; # UTC" 347 | # End: 348 | -------------------------------------------------------------------------------- /config/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2014 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /config/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the 'mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because '.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-time-zone: "UTC" 161 | # time-stamp-end: "; # UTC" 162 | # End: 163 | -------------------------------------------------------------------------------- /config/test-driver: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # test-driver - basic testsuite driver script. 3 | 4 | scriptversion=2013-07-13.22; # UTC 5 | 6 | # Copyright (C) 2011-2013 Free Software Foundation, Inc. 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | # This file is maintained in Automake, please report 27 | # bugs to or send patches to 28 | # . 29 | 30 | # Make unconditional expansion of undefined variables an error. This 31 | # helps a lot in preventing typo-related bugs. 32 | set -u 33 | 34 | usage_error () 35 | { 36 | echo "$0: $*" >&2 37 | print_usage >&2 38 | exit 2 39 | } 40 | 41 | print_usage () 42 | { 43 | cat <$log_file 2>&1 108 | estatus=$? 109 | if test $enable_hard_errors = no && test $estatus -eq 99; then 110 | estatus=1 111 | fi 112 | 113 | case $estatus:$expect_failure in 114 | 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 115 | 0:*) col=$grn res=PASS recheck=no gcopy=no;; 116 | 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 117 | 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; 118 | *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; 119 | *:*) col=$red res=FAIL recheck=yes gcopy=yes;; 120 | esac 121 | 122 | # Report outcome to console. 123 | echo "${col}${res}${std}: $test_name" 124 | 125 | # Register the test result, and other relevant metadata. 126 | echo ":test-result: $res" > $trs_file 127 | echo ":global-test-result: $res" >> $trs_file 128 | echo ":recheck: $recheck" >> $trs_file 129 | echo ":copy-in-global-log: $gcopy" >> $trs_file 130 | 131 | # Local Variables: 132 | # mode: shell-script 133 | # sh-indentation: 2 134 | # eval: (add-hook 'write-file-hooks 'time-stamp) 135 | # time-stamp-start: "scriptversion=" 136 | # time-stamp-format: "%:y-%02m-%02d.%02H" 137 | # time-stamp-time-zone: "UTC" 138 | # time-stamp-end: "; # UTC" 139 | # End: 140 | -------------------------------------------------------------------------------- /contrib/README.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains files that might be useful to analyze iperf3 results 3 | 4 | iperf3_to_gnuplot.py: converts iperf3 JSON output to format easy to plot in gnuplot 5 | 6 | iperf3.gp: sample gnuplot commands to plot throught and retransmits 7 | 8 | 9 | Other iperf3 related projects that might be of interest: 10 | 11 | https://github.com/kaihendry/iperf3chart 12 | 13 | -------------------------------------------------------------------------------- /contrib/iperf3.gp: -------------------------------------------------------------------------------- 1 | # 2 | # sample Gnuplot command file for iperf3 results 3 | set term x11 4 | #set term png 5 | #set term postscript landscape color 6 | set key width -12 7 | 8 | # iperf3 data fields 9 | #start bytes bits_per_second retransmits snd_cwnd 10 | 11 | set output "iperf3.png" 12 | #set output "iperf3.eps" 13 | 14 | #set nokey 15 | 16 | set grid xtics 17 | set grid ytics 18 | set grid linewidth 1 19 | set title "TCP performance: 40G to 10G host" 20 | set xlabel "time (seconds)" 21 | set ylabel "Bandwidth (Gbits/second)" 22 | set xrange [0:60] 23 | set yrange [0:15] 24 | set ytics nomirror 25 | set y2tics 26 | set y2range [0:2500] 27 | # dont plot when retransmits = 0 28 | set datafile missing '0' 29 | set pointsize 1.6 30 | 31 | plot "40Gto10G.old.dat" using 1:3 title '3.10 kernel' with linespoints lw 3 pt 5, \ 32 | "40Gto10G.new.dat" using 1:3 title '4.2 kernel' with linespoints lw 3 pt 7, \ 33 | "40Gto10G.old.dat" using 1:4 title 'retransmits' with points pt 7 axes x1y2 34 | 35 | #plot "iperf3.old.dat" using 1:3 title '3.10 kernel' with linespoints lw 3 pt 5, \ 36 | # "iperf3.new.dat" using 1:3 title '4.2 kernel' with linespoints lw 3 pt 7 37 | 38 | -------------------------------------------------------------------------------- /contrib/iperf3_to_gnuplot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Extract iperf data from json blob and format for gnuplot. 5 | """ 6 | 7 | import json 8 | import os 9 | import sys 10 | 11 | from optparse import OptionParser 12 | 13 | import pprint 14 | # for debugging, so output to stderr to keep verbose 15 | # output out of any redirected stdout. 16 | pp = pprint.PrettyPrinter(indent=4, stream=sys.stderr) 17 | 18 | 19 | def generate_output(iperf, options): 20 | """Do the actual formatting.""" 21 | for i in iperf.get('intervals'): 22 | for ii in i.get('streams'): 23 | if options.verbose: 24 | pp.pprint(ii) 25 | row = '{0} {1} {2} {3} {4}\n'.format( 26 | round(float(ii.get('start')), 4), 27 | ii.get('bytes'), 28 | # to Gbits/sec 29 | round(float(ii.get('bits_per_second')) / (1000*1000*1000), 3), 30 | ii.get('retransmits'), 31 | round(float(ii.get('snd_cwnd')) / (1000*1000), 2) 32 | ) 33 | yield row 34 | 35 | 36 | def summed_output(iperf, options): 37 | """Format summed output.""" 38 | 39 | for i in iperf.get('intervals'): 40 | 41 | row_header = None 42 | 43 | byte = list() 44 | bits_per_second = list() 45 | retransmits = list() 46 | snd_cwnd = list() 47 | 48 | for ii in i.get('streams'): 49 | if options.verbose: 50 | pp.pprint(i) 51 | # grab the first start value 52 | if row_header is None: 53 | row_header = round(float(ii.get('start')), 2) 54 | # aggregate the rest of the values 55 | byte.append(ii.get('bytes')) 56 | bits_per_second.append(float(ii.get('bits_per_second')) / (1000*1000*1000)) 57 | retransmits.append(ii.get('retransmits')) 58 | snd_cwnd.append(float(ii.get('snd_cwnd')) / (1000*1000)) 59 | 60 | row = '{h} {b} {bps} {r} {s}\n'.format( 61 | h=row_header, 62 | b=sum(byte), 63 | bps=round(sum(bits_per_second), 3), 64 | r=sum(retransmits), 65 | s=round(sum(snd_cwnd) / len(snd_cwnd), 2) 66 | ) 67 | 68 | yield row 69 | 70 | 71 | def main(): 72 | """Execute the read and formatting.""" 73 | usage = '%prog [ -f FILE | -o OUT | -v ]' 74 | parser = OptionParser(usage=usage) 75 | parser.add_option('-f', '--file', metavar='FILE', 76 | type='string', dest='filename', 77 | help='Input filename.') 78 | parser.add_option('-o', '--output', metavar='OUT', 79 | type='string', dest='output', 80 | help='Optional file to append output to.') 81 | parser.add_option('-s', '--sum', 82 | dest='summed', action='store_true', default=False, 83 | help='Summed version of the output.') 84 | parser.add_option('-v', '--verbose', 85 | dest='verbose', action='store_true', default=False, 86 | help='Verbose debug output to stderr.') 87 | options, _ = parser.parse_args() 88 | 89 | if not options.filename: 90 | parser.error('Filename is required.') 91 | 92 | file_path = os.path.normpath(options.filename) 93 | 94 | if not os.path.exists(file_path): 95 | parser.error('{f} does not exist'.format(f=file_path)) 96 | 97 | with open(file_path, 'r') as fh: 98 | data = fh.read() 99 | 100 | try: 101 | iperf = json.loads(data) 102 | except Exception as ex: # pylint: disable=broad-except 103 | parser.error('Could not parse JSON from file (ex): {0}'.format(str(ex))) 104 | 105 | if options.output: 106 | absp = os.path.abspath(options.output) 107 | output_dir, _ = os.path.split(absp) 108 | if not os.path.exists(output_dir): 109 | parser.error('Output file directory path {0} does not exist'.format(output_dir)) 110 | fh = open(absp, 'a') 111 | else: 112 | fh = sys.stdout 113 | 114 | if options.summed: 115 | fmt = summed_output 116 | else: 117 | fmt = generate_output 118 | 119 | for i in fmt(iperf, options): 120 | fh.write(i) 121 | 122 | 123 | if __name__ == '__main__': 124 | main() 125 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/iperf.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/iperf.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/iperf" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/iperf" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/_esnet/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, ESnet 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the {organization} nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /docs/_esnet/README.rst: -------------------------------------------------------------------------------- 1 | esnet-gh-pages-base 2 | =================== 3 | 4 | Base templates for ESnet's GitHub pages. These pages are created using the 5 | Sphinx_ documentation package using the sphinx-bootstrap-theme_ with some 6 | pages. This repo is meant to be included into a project using git subtree and 7 | provides the overrides and customizations to the base theme. 8 | 9 | .. _Sphinx: http://sphinx-doc.org 10 | .. _sphinx-bootstrap-theme: https://github.com/ryan-roemer/sphinx-bootstrap-theme 11 | 12 | Installation 13 | ------------ 14 | 15 | 1. Install Sphinx and sphinx-bootstrap-theme. See the instructions below for 16 | installing these either using the Mac OS X base system python or MacPorts. 17 | 2. ``cd $PROJECT_ROOT`` 18 | 3. ``mkdir docs`` 19 | 4. ``git subtree add --prefix docs/_esnet https://github.com/esnet/esnet-gh-pages-base.git master --squash`` 20 | 5. ``cd docs`` 21 | 6. ``sphinx-quickstart`` 22 | 7. ``ln -s ../_esnet/static _static/esnet`` 23 | 8. edit ``conf.py`` as described in the next section 24 | 25 | Editing conf.py 26 | ^^^^^^^^^^^^^^^ 27 | 28 | ``sphinx-quickstart`` creates a basic conf.py file, however to use the ESnet 29 | theme we need to make some changes. Make the following changes to conf.py:: 30 | 31 | # add this with the imports at the top of the file 32 | import sphinx_bootstrap_theme 33 | 34 | # change templates_path to this 35 | templates_path = ['_esnet/templates'] 36 | 37 | # add _esnet to exclude_patterns 38 | exclude_patterns = ['_build', '_esnet'] 39 | 40 | # change html_theme and html_theme_path: 41 | html_theme = 'bootstrap' 42 | html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() 43 | 44 | # add html_theme options: 45 | html_theme_options = { 46 | "navbar_pagenav": False, 47 | "nosidebar": False, 48 | "navbar_class": "navbar", 49 | "navbar_site_name": "Section", 50 | "source_link_position": "footer", 51 | "navbar_links": [ 52 | ("Index", "genindex"), 53 | ("ESnet", "https://www.es.net", True), 54 | ], 55 | } 56 | 57 | # add html_logo and html_sidebars 58 | html_logo = "_esnet/static/logo-esnet-ball-sm.png" 59 | html_sidebars = {'index': None, 'search': None, '*': ['localtoc.html']} 60 | html_favicon = "_esnet/static/favicon.ico" 61 | html_context = { 62 | "github_url": "https://github.com/esnet/PROJNAME", 63 | } 64 | 65 | That's it! 66 | 67 | Sphinx Installation using Mac OS X Base Python 68 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 69 | 70 | 1. sudo /usr/bin/easy_install pip 71 | 2. sudo /usr/local/bin/pip install sphinx sphinx-bootstrap-theme 72 | 73 | Sphinx Installation using MacPorts 74 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 75 | 76 | 1. port install python27 py27-pip py27-sphinx 77 | 2. port select pip py27-pip 78 | 3. port select sphinx py27-sphinx 79 | 4. pip install sphinx sphinx-bootstrap-theme # make sure this is 80 | /opt/local/bin/pip 81 | 82 | Creating Content, Previewing and Publishing 83 | ------------------------------------------- 84 | 85 | The files are in the ``docs`` directory. Take a look at the content of 86 | ``index.rst``. Take a look at the docs from other projects and review the 87 | documentation for Sphinx_. 88 | 89 | Building HTML 90 | ^^^^^^^^^^^^^ 91 | 92 | In the ``docs`` directory run ``make clean html``. 93 | 94 | Previewing the site 95 | ^^^^^^^^^^^^^^^^^^^ 96 | 97 | ``open _build/html/index.html`` 98 | 99 | or 100 | 101 | ``open -a /Application/Google\ Chrome.app _build/html/index.html`` 102 | 103 | Publishing the site 104 | ^^^^^^^^^^^^^^^^^^^ 105 | 106 | From the ``docs`` directory run ``_esnet/deploy.sh``. It will be visible at: 107 | ``http://github.com/esnet/PROJECT``. 108 | -------------------------------------------------------------------------------- /docs/_esnet/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | GIT_URL=`git remote show origin | awk '/Push URL/ { print $NF }'` 4 | DEPLOY_DIR=/tmp/deploy.$$ 5 | mkdir ${DEPLOY_DIR} 6 | (cd ${DEPLOY_DIR} ; \ 7 | git clone ${GIT_URL} . \ 8 | && git checkout gh-pages \ 9 | && git rm -rf . 10 | ) 11 | cp -r _build/html/* ${DEPLOY_DIR} 12 | touch ${DEPLOY_DIR}/.nojekyll 13 | (cd ${DEPLOY_DIR} ; \ 14 | git add .nojekyll * \ 15 | && git commit -m "deploy" \ 16 | && git push) 17 | 18 | rm -rf ${DEPLOY_DIR} 19 | -------------------------------------------------------------------------------- /docs/_esnet/static/esnet.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 70px; // bootstrap default 3 | } 4 | 5 | .navbar-default { 6 | background-color: #006495; 7 | border-color: #004e74; 8 | } 9 | .navbar-default .navbar-brand { 10 | color: #ecf0f1; 11 | } 12 | .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { 13 | color: #ffffff; 14 | } 15 | .navbar-default .navbar-text { 16 | color: #ecf0f1; 17 | } 18 | .navbar-default .navbar-nav > li > a { 19 | color: #ecf0f1; 20 | } 21 | .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { 22 | color: #ffffff; 23 | } 24 | .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { 25 | color: #ffffff; 26 | background-color: #004e74; 27 | } 28 | .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus { 29 | color: #ffffff; 30 | background-color: #004e74; 31 | } 32 | .navbar-default .navbar-toggle { 33 | border-color: #004e74; 34 | } 35 | .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { 36 | background-color: #004e74; 37 | } 38 | .navbar-default .navbar-toggle .icon-bar { 39 | background-color: #ecf0f1; 40 | } 41 | .navbar-default .navbar-collapse, 42 | .navbar-default .navbar-form { 43 | border-color: #ecf0f1; 44 | } 45 | .navbar-default .navbar-link { 46 | color: #ecf0f1; 47 | } 48 | .navbar-default .navbar-link:hover { 49 | color: #ffffff; 50 | } 51 | 52 | @media (max-width: 767px) { 53 | .navbar-default .navbar-nav .open .dropdown-menu > li > a { 54 | color: #ecf0f1; 55 | } 56 | .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { 57 | color: #ffffff; 58 | } 59 | .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { 60 | color: #ffffff; 61 | background-color: #004e74; 62 | } 63 | } 64 | 65 | /* 66 | * Veritcal divider 67 | */ 68 | .navbar .divider-vertical { 69 | height: 50px; 70 | margin: 0 9px; 71 | border-right: 1px solid #ecf0f1; 72 | border-left: 1px solid #ecf0f1; 73 | } 74 | 75 | .navbar-inverse .divider-vertical { 76 | border-right-color: #222222; 77 | border-left-color: #111111; 78 | } 79 | 80 | @media (max-width: 767px) { 81 | .navbar-collapse .nav > .divider-vertical { 82 | display: none; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /docs/_esnet/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/favicon.ico -------------------------------------------------------------------------------- /docs/_esnet/static/icon-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/icon-github.png -------------------------------------------------------------------------------- /docs/_esnet/static/logo-esnet-ball-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/logo-esnet-ball-sm.png -------------------------------------------------------------------------------- /docs/_esnet/static/logo-esnet-ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/logo-esnet-ball.png -------------------------------------------------------------------------------- /docs/_esnet/static/logo-esnet-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/logo-esnet-name.png -------------------------------------------------------------------------------- /docs/_esnet/static/logo-esnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansyun/dpdk-iperf/00da717da1d6c6cd71f45f2c68497eccef9a2093/docs/_esnet/static/logo-esnet.png -------------------------------------------------------------------------------- /docs/_esnet/templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | 3 | {% set theme_css_files = [] %} 4 | {% if theme_bootstrap_version == "3" %} 5 | {% set bootstrap_version, bootstrap_additional_css, navbar_version = "3.1.0", "theme", "" %} 6 | {% set bs_span_prefix = "col-md-" %} 7 | {% else %} 8 | {% set bootstrap_version, bootstrap_additional_css, navbar_version = "2.3.2", "responsive", "-2" %} 9 | {% set bs_span_prefix = "span" %} 10 | {% endif %} 11 | 12 | {% set theme_css_files = theme_css_files + [ 13 | '_static/bootstrap-' + bootstrap_version + '/css/bootstrap.min.css', 14 | '_static/bootstrap-sphinx.css', 15 | '_static/esnet/esnet.css' 16 | ] 17 | %} 18 | 19 | {% if not bootswatch_css_custom %} 20 | {% set bootswatch_css_custom = [] %} 21 | {% endif %} 22 | {% set css_files = css_files + theme_css_files + bootswatch_css_custom %} 23 | 24 | {% set script_files = script_files + [ 25 | '_static/js/jquery-1.11.0.min.js', 26 | '_static/js/jquery-fix.js', 27 | '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js', 28 | '_static/bootstrap-sphinx.js' 29 | ] 30 | %} 31 | 32 | {%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %} 33 | {# set render_sidebar = True %} 34 | {%- set sidebars = ['localtoc.html', 'sourcelink.html', 'searchbox.html'] #} 35 | {%- set bs_content_width = render_sidebar and "9" or "9"%} 36 | 37 | {%- block doctype -%} 38 | 39 | {%- endblock %} 40 | 41 | {# Sidebar: Rework into our Bootstrap nav section. #} 42 | {% macro navBar() %} 43 | {% include "navbar" + navbar_version + ".html" %} 44 | {% endmacro %} 45 | 46 | {% if theme_bootstrap_version == "3" %} 47 | {%- macro bsidebar() %} 48 | {%- if render_sidebar %} 49 |
50 | 55 |
56 | {%- else %} 57 |
58 | {%- endif %} 59 | {%- endmacro %} 60 | {% else %} 61 | {%- macro bsidebar() %} 62 | {%- if render_sidebar %} 63 |
64 | 69 |
70 | {%- endif %} 71 | {%- endmacro %} 72 | {% endif %} 73 | 74 | {%- block extrahead %} 75 | 76 | 77 | 78 | 79 | {% endblock %} 80 | 81 | {# Silence the sidebar's, relbar's #} 82 | {% block header %}{% endblock %} 83 | {% block relbar1 %}{% endblock %} 84 | {% block relbar2 %}{% endblock %} 85 | {% block sidebarsourcelink %}{% endblock %} 86 | 87 | {%- block content %} 88 | {{ navBar() }} 89 |
90 |
91 | {%- block sidebar1 %}{{ bsidebar() }}{% endblock %} 92 |
93 | {% block body %}{% endblock %} 94 |
95 | {% block sidebar2 %} {# possible location for sidebar #} {% endblock %} 96 |
97 |
98 | {%- endblock %} 99 | 100 | {%- block footer %} 101 |
102 |
103 |
104 |
105 | [ESnet] 106 |
107 |
108 |

109 | Back to top 110 | {% if theme_source_link_position == "footer" %} 111 |
112 | {% include "sourcelink.html" %} 113 | {% endif %} 114 |

115 |

116 | {%- if show_copyright %} 117 | {%- if hasdoc('copyright') %} 118 | {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
119 | {%- else %} 120 | {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
121 | {%- endif %} 122 | {%- endif %} 123 | {%- if last_updated %} 124 | {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
125 | {%- endif %} 126 | {%- if show_sphinx %} 127 | {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
128 | {%- endif %} 129 |

130 |
131 |
132 |
133 |
134 | {%- endblock %} 135 | -------------------------------------------------------------------------------- /docs/_esnet/templates/navbar.html: -------------------------------------------------------------------------------- 1 | 52 | -------------------------------------------------------------------------------- /docs/_esnet/templates/relations.html: -------------------------------------------------------------------------------- 1 | {# Switch to icon instead of text in `sm` view size for BS3 only. #} 2 | {%- if prev %} 3 |
  • 4 | 5 | 6 | 9 | 10 |
  • 11 | {%- endif %} 12 | {%- if next %} 13 |
  • 14 | 15 | 18 | 19 | 20 |
  • 21 | {%- endif %} 22 | -------------------------------------------------------------------------------- /docs/building.rst: -------------------------------------------------------------------------------- 1 | Building iperf3 2 | =============== 3 | 4 | Building iperf3, as with most tools of this type, is a fairly 5 | straightforward operation. The instructions in this section assume 6 | that the source distribution has already been unpacked. 7 | 8 | Prerequisites 9 | ------------- 10 | 11 | iperf3 requires few (if any) dependencies on common operating 12 | systems. The only known prerequisites are listed here. 13 | 14 | Building 15 | -------- 16 | 17 | In many cases, iperf3 can be built and installed as follows: 18 | 19 | ``./configure && make && make install`` 20 | 21 | In some cases, configuration might fail. If this happens, it might 22 | help to run ``./bootstrap.sh`` first from the top-level directory. 23 | 24 | By default, the ``libiperf`` library is built in both shared and 25 | static forms. Either can be suppressed by using the 26 | ``--disabled-shared`` or ``--disable-static`` configure-time options. 27 | 28 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # iperf documentation build configuration file, created by 4 | # sphinx-quickstart on Fri Mar 28 14:58:40 2014. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | import sphinx_bootstrap_theme 18 | 19 | # If extensions (or modules to document with autodoc) are in another directory, 20 | # add these directories to sys.path here. If the directory is relative to the 21 | # documentation root, use os.path.abspath to make it absolute, like shown here. 22 | #sys.path.insert(0, os.path.abspath('.')) 23 | 24 | # -- General configuration ------------------------------------------------ 25 | 26 | # If your documentation needs a minimal Sphinx version, state it here. 27 | #needs_sphinx = '1.0' 28 | 29 | # Add any Sphinx extension module names here, as strings. They can be 30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 31 | # ones. 32 | extensions = [] 33 | 34 | # Add any paths that contain templates here, relative to this directory. 35 | templates_path = ['_esnet/templates'] 36 | 37 | # The suffix of source filenames. 38 | source_suffix = '.rst' 39 | 40 | # The encoding of source files. 41 | #source_encoding = 'utf-8-sig' 42 | 43 | # The master toctree document. 44 | master_doc = 'index' 45 | 46 | # General information about the project. 47 | project = u'iperf3' 48 | copyright = u'2014-2016, ESnet' 49 | 50 | # The version info for the project you're documenting, acts as replacement for 51 | # |version| and |release|, also used in various other places throughout the 52 | # built documents. 53 | # 54 | # The short X.Y version. 55 | version = '3.1.2' 56 | # The full version, including alpha/beta/rc tags. 57 | release = '3.1.2' 58 | 59 | # The language for content autogenerated by Sphinx. Refer to documentation 60 | # for a list of supported languages. 61 | #language = None 62 | 63 | # There are two options for replacing |today|: either, you set today to some 64 | # non-false value, then it is used: 65 | #today = '' 66 | # Else, today_fmt is used as the format for a strftime call. 67 | #today_fmt = '%B %d, %Y' 68 | 69 | # List of patterns, relative to source directory, that match files and 70 | # directories to ignore when looking for source files. 71 | exclude_patterns = ['_build', '_esnet'] 72 | 73 | # The reST default role (used for this markup: `text`) to use for all 74 | # documents. 75 | #default_role = None 76 | 77 | # If true, '()' will be appended to :func: etc. cross-reference text. 78 | #add_function_parentheses = True 79 | 80 | # If true, the current module name will be prepended to all description 81 | # unit titles (such as .. function::). 82 | #add_module_names = True 83 | 84 | # If true, sectionauthor and moduleauthor directives will be shown in the 85 | # output. They are ignored by default. 86 | #show_authors = False 87 | 88 | # The name of the Pygments (syntax highlighting) style to use. 89 | pygments_style = 'sphinx' 90 | 91 | # A list of ignored prefixes for module index sorting. 92 | #modindex_common_prefix = [] 93 | 94 | # If true, keep warnings as "system message" paragraphs in the built documents. 95 | #keep_warnings = False 96 | 97 | 98 | # -- Options for HTML output ---------------------------------------------- 99 | 100 | # The theme to use for HTML and HTML Help pages. See the documentation for 101 | # a list of builtin themes. 102 | html_theme = 'bootstrap' 103 | 104 | # Theme options are theme-specific and customize the look and feel of a theme 105 | # further. For a list of options available for each theme, see the 106 | # documentation. 107 | html_theme_options = { 108 | "navbar_pagenav": False, 109 | "nosidebar": False, 110 | "navbar_class": "navbar", 111 | "navbar_site_name": "Section", 112 | "navbar_links": [ 113 | ("Index", "genindex"), 114 | ("ESnet", "https://www.es.net", True), 115 | ], 116 | } 117 | 118 | # Add any paths that contain custom themes here, relative to this directory. 119 | html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() 120 | 121 | # The name for this set of Sphinx documents. If None, it defaults to 122 | # " v documentation". 123 | #html_title = None 124 | 125 | # A shorter title for the navigation bar. Default is the same as html_title. 126 | #html_short_title = None 127 | 128 | # The name of an image file (relative to this directory) to place at the top 129 | # of the sidebar. 130 | html_logo = "_esnet/static/logo-esnet-ball-sm.png" 131 | 132 | 133 | # The name of an image file (within the static path) to use as favicon of the 134 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 135 | # pixels large. 136 | html_favicon = "_esnet/static/favicon.ico" 137 | html_context = { 138 | "github_url": "https://github.com/esnet/iperf", 139 | } 140 | 141 | # Add any paths that contain custom static files (such as style sheets) here, 142 | # relative to this directory. They are copied after the builtin static files, 143 | # so a file named "default.css" will overwrite the builtin "default.css". 144 | html_static_path = ['_static'] 145 | 146 | # Add any extra paths that contain custom files (such as robots.txt or 147 | # .htaccess) here, relative to this directory. These files are copied 148 | # directly to the root of the documentation. 149 | #html_extra_path = [] 150 | 151 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 152 | # using the given strftime format. 153 | #html_last_updated_fmt = '%b %d, %Y' 154 | 155 | # If true, SmartyPants will be used to convert quotes and dashes to 156 | # typographically correct entities. 157 | #html_use_smartypants = True 158 | 159 | # Custom sidebar templates, maps document names to template names. 160 | html_sidebars = {'index': None, 'search': None, '*': ['localtoc.html']} 161 | 162 | # Additional templates that should be rendered to pages, maps page names to 163 | # template names. 164 | #html_additional_pages = {} 165 | 166 | # If false, no module index is generated. 167 | #html_domain_indices = True 168 | 169 | # If false, no index is generated. 170 | #html_use_index = True 171 | 172 | # If true, the index is split into individual pages for each letter. 173 | #html_split_index = False 174 | 175 | # If true, links to the reST sources are added to the pages. 176 | #html_show_sourcelink = True 177 | 178 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 179 | #html_show_sphinx = True 180 | 181 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 182 | #html_show_copyright = True 183 | 184 | # If true, an OpenSearch description file will be output, and all pages will 185 | # contain a tag referring to it. The value of this option must be the 186 | # base URL from which the finished HTML is served. 187 | #html_use_opensearch = '' 188 | 189 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 190 | #html_file_suffix = None 191 | 192 | # Output file base name for HTML help builder. 193 | htmlhelp_basename = 'iperfdoc' 194 | 195 | 196 | # -- Options for LaTeX output --------------------------------------------- 197 | 198 | latex_elements = { 199 | # The paper size ('letterpaper' or 'a4paper'). 200 | #'papersize': 'letterpaper', 201 | 202 | # The font size ('10pt', '11pt' or '12pt'). 203 | #'pointsize': '10pt', 204 | 205 | # Additional stuff for the LaTeX preamble. 206 | #'preamble': '', 207 | } 208 | 209 | # Grouping the document tree into LaTeX files. List of tuples 210 | # (source start file, target name, title, 211 | # author, documentclass [howto, manual, or own class]). 212 | latex_documents = [ 213 | ('index', 'iperf.tex', u'iperf Documentation', 214 | u'ESnet', 'manual'), 215 | ] 216 | 217 | # The name of an image file (relative to this directory) to place at the top of 218 | # the title page. 219 | #latex_logo = None 220 | 221 | # For "manual" documents, if this is true, then toplevel headings are parts, 222 | # not chapters. 223 | #latex_use_parts = False 224 | 225 | # If true, show page references after internal links. 226 | #latex_show_pagerefs = False 227 | 228 | # If true, show URL addresses after external links. 229 | #latex_show_urls = False 230 | 231 | # Documents to append as an appendix to all manuals. 232 | #latex_appendices = [] 233 | 234 | # If false, no module index is generated. 235 | #latex_domain_indices = True 236 | 237 | 238 | # -- Options for manual page output --------------------------------------- 239 | 240 | # One entry per manual page. List of tuples 241 | # (source start file, name, description, authors, manual section). 242 | man_pages = [ 243 | ('index', 'iperf', u'iperf Documentation', 244 | [u'ESnet'], 1) 245 | ] 246 | 247 | # If true, show URL addresses after external links. 248 | #man_show_urls = False 249 | 250 | 251 | # -- Options for Texinfo output ------------------------------------------- 252 | 253 | # Grouping the document tree into Texinfo files. List of tuples 254 | # (source start file, target name, title, author, 255 | # dir menu entry, description, category) 256 | texinfo_documents = [ 257 | ('index', 'iperf', u'iperf Documentation', 258 | u'ESnet', 'iperf', 'One line description of project.', 259 | 'Miscellaneous'), 260 | ] 261 | 262 | # Documents to append as an appendix to all manuals. 263 | #texinfo_appendices = [] 264 | 265 | # If false, no module index is generated. 266 | #texinfo_domain_indices = True 267 | 268 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 269 | #texinfo_show_urls = 'footnote' 270 | 271 | # If true, do not generate a @detailmenu in the "Top" node's menu. 272 | #texinfo_no_detailmenu = False 273 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. iperf documentation master file, created by 2 | sphinx-quickstart on Fri Mar 28 14:58:40 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | iperf3 7 | ====== 8 | 9 | iperf is a tool for active measurements of the maximum achievable 10 | bandwidth on IP networks. It supports tuning of various parameters 11 | related to timing, protocols, and buffers. For each test it reports 12 | the bandwidth, loss, and other parameters. 13 | 14 | This version, sometimes referred to as iperf3, is a redesign of an 15 | original version developed at NLANR / DAST. iperf3 is a new 16 | implementation from scratch, with the goal of a smaller, simpler code 17 | base, and a library version of the functionality that can be used in 18 | other programs. iperf3 also incorporates a number of features found in 19 | other tools such as nuttcp and netperf, but were missing from the 20 | original iperf. These include, for example, a zero-copy mode and 21 | optional JSON output. Note that iperf3 is *not* backwards compatible 22 | with the original iperf. 23 | 24 | Primary development for iperf3 takes place on CentOS 6 Linux, FreeBSD 25 | 10, and MacOS 10.10. At this time, these are the only officially 26 | supported platforms, however there have been some reports of success 27 | with OpenBSD, Android, and other Linux distributions. 28 | 29 | iperf3 is principally developed by `ESnet `_ / 30 | `Lawrence Berkeley National Laboratory `_. It 31 | is released under a three-clause BSD license. 32 | 33 | Links for the Impatient 34 | ----------------------- 35 | 36 | Project homepage and documentation hosted on GitHub Pages: 37 | http://software.es.net/iperf/ 38 | 39 | Project site (source code repository, issue tracker) hosted on GitHub: 40 | https://github.com/esnet/iperf 41 | 42 | Source code downloads: 43 | http://downloads.es.net/pub/iperf/ 44 | 45 | Contents 46 | -------- 47 | 48 | .. toctree:: 49 | :maxdepth: 2 50 | 51 | news 52 | obtaining 53 | building 54 | invoking 55 | dev 56 | 57 | Indices and tables 58 | ------------------ 59 | 60 | * :ref:`genindex` 61 | * :ref:`modindex` 62 | * :ref:`search` 63 | 64 | -------------------------------------------------------------------------------- /docs/invoking.rst: -------------------------------------------------------------------------------- 1 | Invoking iperf3 2 | =============== 3 | 4 | iperf3 includes a manual page listing all of the command-line options. 5 | The manual page is the most up-to-date reference to the various flags and parameters. 6 | 7 | For sample command line usage, see: 8 | 9 | http://fasterdata.es.net/performance-testing/network-troubleshooting-tools/iperf-and-iperf3/ 10 | 11 | Using the default options, iperf3 is meant to show typical well 12 | designed application performance. "Typical well designed application" 13 | means avoiding artificial enhancements that work only for testing 14 | (such as ``splice()``-ing the data to ``/dev/null``). iperf3 does 15 | also have flags for "extreme best case" optimizations but they must be 16 | explicitly activated. These flags include the ``-Z`` (``--zerocopy``) 17 | and ``-A`` (``--affinity``) options. 18 | 19 | iperf3 Manual Page 20 | ------------------ 21 | 22 | This section contains a plaintext rendering of the iperf3 manual page. 23 | It is presented here only for convenience; the authoritative iperf3 24 | manual page is included in the source tree and installed along with 25 | the executable. 26 | 27 | :: 28 | 29 | IPERF(1) User Manuals IPERF(1) 30 | 31 | 32 | 33 | NAME 34 | iperf3 − perform network throughput tests 35 | 36 | SYNOPSIS 37 | iperf3 ‐s [ options ] 38 | iperf3 ‐c server [ options ] 39 | 40 | 41 | DESCRIPTION 42 | iperf3 is a tool for performing network throughput measurements. It 43 | can test either TCP or UDP throughput. To perform an iperf3 test the 44 | user must establish both a server and a client. 45 | 46 | 47 | GENERAL OPTIONS 48 | ‐p, ‐‐port n 49 | set server port to listen on/connect to to n (default 5201) 50 | 51 | ‐f, ‐‐format 52 | [kmKM] format to report: Kbits, Mbits, KBytes, MBytes 53 | 54 | ‐i, ‐‐interval n 55 | pause n seconds between periodic bandwidth reports; default is 56 | 1, use 0 to disable 57 | 58 | ‐F, ‐‐file name 59 | client‐side: read from the file and write to the network, 60 | instead of using random data; server‐side: read from the network 61 | and write to the file, instead of throwing the data away 62 | 63 | ‐A, ‐‐affinity n/n,m 64 | Set the CPU affinity, if possible (Linux and FreeBSD only). On 65 | both the client and server you can set the local affinity by 66 | using the n form of this argument (where n is a CPU number). In 67 | addition, on the client side you can override the server’s 68 | affinity for just that one test, using the n,m form of argument. 69 | Note that when using this feature, a process will only be bound 70 | to a single CPU (as opposed to a set containing potentialy mul‐ 71 | tiple CPUs). 72 | 73 | ‐B, ‐‐bind host 74 | bind to a specific interface 75 | 76 | ‐V, ‐‐verbose 77 | give more detailed output 78 | 79 | ‐J, ‐‐json 80 | output in JSON format 81 | 82 | ‐‐logfile file 83 | send output to a log file. 84 | 85 | --forceflush 86 | force flushing output at every interval. Used to avoid buffering when sending 87 | output to pipe. 88 | 89 | ‐d, ‐‐debug 90 | emit debugging output. Primarily (perhaps exclusively) of use 91 | to developers. 92 | 93 | ‐v, ‐‐version 94 | show version information and quit 95 | 96 | ‐h, ‐‐help 97 | show a help synopsis 98 | 99 | 100 | SERVER SPECIFIC OPTIONS 101 | ‐s, ‐‐server 102 | run in server mode 103 | 104 | ‐D, ‐‐daemon 105 | run the server in background as a daemon 106 | 107 | ‐I, ‐‐pidfile file 108 | write a file with the process ID, most useful when running as a 109 | daemon. 110 | 111 | 112 | CLIENT SPECIFIC OPTIONS 113 | ‐c, ‐‐client host 114 | run in client mode, connecting to the specified server 115 | 116 | ‐‐sctp use SCTP rather than TCP (FreeBSD and Linux) 117 | 118 | ‐u, ‐‐udp 119 | use UDP rather than TCP 120 | 121 | ‐b, ‐‐bandwidth n[KM] 122 | set target bandwidth to n bits/sec (default 1 Mbit/sec for UDP, 123 | unlimited for TCP). If there are multiple streams (‐P flag), 124 | the bandwidth limit is applied separately to each stream. You 125 | can also add a ’/’ and a number to the bandwidth specifier. 126 | This is called "burst mode". It will send the given number of 127 | packets without pausing, even if that temporarily exceeds the 128 | specified bandwidth limit. 129 | 130 | ‐t, ‐‐time n 131 | time in seconds to transmit for (default 10 secs) 132 | 133 | ‐n, ‐‐bytes n[KM] 134 | number of bytes to transmit (instead of ‐t) 135 | 136 | ‐k, ‐‐blockcount n[KM] 137 | number of blocks (packets) to transmit (instead of ‐t or ‐n) 138 | 139 | ‐l, ‐‐length n[KM] 140 | length of buffer to read or write (default 128 KB for TCP, 8KB 141 | for UDP) 142 | 143 | ‐P, ‐‐parallel n 144 | number of parallel client streams to run 145 | 146 | ‐R, ‐‐reverse 147 | run in reverse mode (server sends, client receives) 148 | 149 | ‐w, ‐‐window n[KM] 150 | TCP window size / socket buffer size (this gets sent to the 151 | server and used on that side too) 152 | 153 | ‐M, ‐‐set‐mss n 154 | set TCP maximum segment size (MTU ‐ 40 bytes) 155 | 156 | ‐N, ‐‐no‐delay 157 | set TCP no delay, disabling Nagle’s Algorithm 158 | 159 | ‐4, ‐‐version4 160 | only use IPv4 161 | 162 | ‐6, ‐‐version6 163 | only use IPv6 164 | 165 | ‐S, ‐‐tos n 166 | set the IP ’type of service’ 167 | 168 | ‐L, ‐‐flowlabel n 169 | set the IPv6 flow label (currently only supported on Linux) 170 | 171 | ‐Z, ‐‐zerocopy 172 | Use a "zero copy" method of sending data, such as sendfile(2), 173 | instead of the usual write(2). 174 | 175 | ‐O, ‐‐omit n 176 | Omit the first n seconds of the test, to skip past the TCP slow‐ 177 | start period. 178 | 179 | ‐T, ‐‐title str 180 | Prefix every output line with this string. 181 | 182 | ‐C, ‐‐linux‐congestion algo 183 | Set the congestion control algorithm (linux only). 184 | 185 | 186 | AUTHORS 187 | Iperf was originally written by Mark Gates and Alex Warshavsky. Man 188 | page and maintence by Jon Dugan . Other con‐ 189 | tributions from Ajay Tirumala, Jim Ferguson, Feng Qin, Kevin Gibbs, 190 | John Estabrook , Andrew Gallatin , Stephen Hemminger 192 | 193 | 194 | SEE ALSO 195 | libiperf(3), https://github.com/esnet/iperf 196 | 197 | 198 | 199 | ESnet February 2014 IPERF(1) 200 | 201 | The iperf3 manual page will typically be installed in manual 202 | section 1. 203 | 204 | -------------------------------------------------------------------------------- /docs/news.rst: -------------------------------------------------------------------------------- 1 | iperf3 Project News 2 | =================== 3 | 4 | 2016-02-01: iperf-3.1.2 released 5 | --------------------------------- 6 | 7 | | URL: http://downloads.es.net/pub/iperf/iperf-3.1.2.tar.gz 8 | | SHA256: ``f9dbdb99f869c077d14bc1de78675f5e4b8d1bf78dc92381e96c3eb5b1fd7d86 iperf-3.1.2.tar.gz`` 9 | 10 | This release fixes a couple of minor bugs, including one that results 11 | in invalid JSON being emitted for UDP tests. 12 | 13 | 2015-11-19: iperf-3.1.1 released 14 | --------------------------------- 15 | 16 | | URL: http://downloads.es.net/pub/iperf/iperf-3.1.1.tar.gz 17 | | SHA256: ``62f7c64eafe19046ba974b3ef2d962a5597194d6fbbddde328a15a5e74110564 iperf-3.1.1.tar.gz`` 18 | 19 | This release fixes a few minor bugs. 20 | 21 | 2015-10-16: iperf3 Development Status 22 | -------------------------------------- 23 | 24 | Beginning with the release of iperf 3.1, ESnet plans to support iperf3 25 | in "maintenance mode". At this point, we have no definite plans for 26 | further iperf3 releases, and ESnet will be providing a very limited 27 | amount of resources for support and development, going forward. 28 | However, ESnet could issue new iperf3 releases to deal with security 29 | issues or high-impact bug fixes. 30 | 31 | Requests for support, enhancements, and questions should best be 32 | directed to the iperf-dev mailing list. ESnet would be open to adding 33 | project members/committers from the community, in case there are 34 | developers who are interested in doing more active work with iperf3 35 | and/or supporting the user base. 36 | 37 | 38 | 2015-10-16: iperf-3.1 released 39 | ------------------------------- 40 | 41 | | URL: http://downloads.es.net/pub/iperf/iperf-3.1.tar.gz 42 | | SHA256: ``4385a32ece25cb09d4606b4c99316356b3d2cb03b318aa056b99cdb91c5ce656 iperf-3.1.tar.gz`` 43 | 44 | This release adds support for SCTP on supported platforms, better 45 | feature detection on FreeBSD, better compatibility with various 46 | platforms, and a number of bug fixes. 47 | 48 | 49 | 2015-01-09: iperf-3.0.11 released 50 | ---------------------------------- 51 | 52 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.11.tar.gz 53 | | SHA256: ``e01db5be6f47f67c987463095fe4f5b8b9ff891fb92c39104d042ad8fde97f6e iperf-3.0.11.tar.gz`` 54 | 55 | This maintenance release adds a -1 flag to make the iperf3 execute a 56 | single test and exit, needed for an upcoming bwctl release. A few 57 | other bugs are also fixed. 58 | 59 | Older News 60 | ---------- 61 | 62 | 2014-12-16: iperf-3.0.10 released 63 | .................................. 64 | 65 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.10.tar.gz 66 | | SHA256: ``a113442967cf0981b0b2d538be7c88903b2fb0f87b0d281384e41b462e33059d iperf-3.0.10.tar.gz`` 67 | 68 | This maintenance release fixes building on MacOS X Yosemite, as well 69 | as making the -w option work correctly with UDP tests. 70 | 71 | 2014-10-14: iperf-3.0.9 released 72 | ................................. 73 | 74 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.9.tar.gz 75 | | SHA256: ``40249a2b30d26b937350b969bcb19f88e1beb356f886ed31422b554bac692459 iperf-3.0.9.tar.gz`` 76 | 77 | This maintenance release fixes an issue for a situation in which 78 | attempting a UDP test with pathologically large (and illegal) packet 79 | sizes could put the iperf3 server in a state where it would stop 80 | accepting connections from clients, thus causing the clients to crash 81 | when interrupted. 82 | 83 | 84 | 2014-09-30: iperf-3.0.8 released 85 | ................................. 86 | 87 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.8.tar.gz 88 | | SHA256: ``81b8d91159862896c57f9b90a006e8b5dc22bd94175d97bd0db50b0ae2c1a78e iperf-3.0.8.tar.gz`` 89 | 90 | This maintenance release is functionally identical to 3.0.7. It 91 | incorporates updated license verbage and a minor compilation fix. 92 | 93 | 94 | 2014-08-28: iperf-3.0.7 released 95 | ................................. 96 | 97 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.7.tar.gz 98 | | SHA256: ``49510e886f9e876cd73dcd80414bfb8c49b147c82125585e09c2a6e92369d3f2 iperf-3.0.7.tar.gz`` 99 | 100 | This maintenance release fixes several minor bugs. Of particular 101 | note: 102 | 103 | * A bug that caused some problems with bwctl / perfSONAR has been 104 | fixed. 105 | 106 | * A bug that made it possible to disrupt existing, running tests has 107 | been fixed. 108 | 109 | 2014-07-28: iperf-3.0.6 released 110 | ................................. 111 | 112 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.6.tar.gz 113 | | SHA256: ``3c5909c9b286b6503ffa141a94cfc588915d6e67f2aa732b08df0af73e21938 iperf-3.0.6.tar.gz`` 114 | 115 | This maintenance release includes the following bug fixes: 116 | 117 | * Several problems with the -B option have been fixed. Also, API 118 | calls have been added to libiperf to extend this functionality to 119 | API clients. 120 | 121 | * Some portability fixes for OpenBSD and Solaris have been merged from 122 | the mainline. 123 | 124 | As always, more details can be found in the ``RELEASE_NOTES`` file in 125 | the source distribution. 126 | 127 | 2014-06-16: Project documentation on GitHub Pages 128 | .................................................. 129 | 130 | iperf3 project documentation can now be found at: 131 | 132 | | URL: http://software.es.net/iperf/ 133 | 134 | This is a GitHub Pages site. In an ongoing series of steps, content 135 | will be migrated from the iperf3 wiki to GitHub Pages. 136 | 137 | 2014-06-16: iperf-3.0.5 released 138 | ................................. 139 | 140 | | URL: http://downloads.es.net/pub/iperf/iperf-3.0.5.tar.gz 141 | | SHA256: ``e1e1989985b17a4c03b0fa207004ad164b137e37ab0682fecbf5e93bcaa920a6 iperf-3.0.5.tar.gz`` 142 | 143 | This is the third maintenance release of iperf 3, with few more 144 | enhancements and bug fixes. Highlights: 145 | 146 | * A timing issue which caused measurement intervals to be wrong with 147 | TCP tests on lossy networks has been fixed. 148 | 149 | * It is now possible to get (most of) the server-side output at 150 | the client by using the ``--get-server-output`` flag. 151 | 152 | * A number of bugs with ``--json`` output have been fixed. 153 | 154 | A more extensive list of changes can always be found in the 155 | ``RELEASE_NOTES`` file in the source distribution. 156 | 157 | Note: An iperf-3.0.4 release was planned and tagged, but not 158 | officially released. 159 | 160 | 2014-06-10: New iperf3 download site 161 | ..................................... 162 | 163 | iperf3 downloads are now hosted on a new server at ESnet: 164 | 165 | | URL: http://downloads.es.net/pub/iperf/ 166 | 167 | Going forward, new releases will be made available in this directory. 168 | Older releases will, at least for now, continue to also be available 169 | at the previous location. 170 | 171 | 2014-03-26: iperf-3.0.3 released 172 | ................................. 173 | 174 | | URL: http://stats.es.net/software/iperf-3.0.3.tar.gz 175 | | SHA256: ``79daf3e5e5c933b2fc4843d6d21c98d741fe39b33ac05bd7a11c50d321a2f59d iperf-3.0.3.tar.gz`` 176 | 177 | This is the second maintenance release of iperf 3.0, containing a few bug fixes and enhancements, notably: 178 | 179 | * The structure of the JSON output is more consistent between the 180 | cases of one stream and multiple streams. 181 | 182 | * The example programs once again build correctly. 183 | 184 | * A possible buffer overflow related to error output has been fixed. 185 | (This is not believed to be exploitable.) 186 | 187 | More information on changes can be found in the ``RELEASE_NOTES`` 188 | file in the source distribution. 189 | 190 | 2014-03-10: iperf-3.0.2 released 191 | ................................. 192 | 193 | | URL: http://stats.es.net/software/iperf-3.0.2.tar.gz 194 | | SHA256: ``3c379360bf40e6ac91dfc508cb43fefafb4739c651d9a8d905a30ec99095b282 iperf-3.0.2.tar.gz`` 195 | 196 | **Note:** Due to a mistake in the release process, the distribution tarball referred to above is actually not compressed, despite its ``.tar.gz`` extension. Instead it is an uncompressed tar archive. The file checksum is correct, as are the file contents. 197 | 198 | This version is a maintenance release that 199 | fixes a number of bugs, many reported by users, adds a few minor 200 | enhancements, and tracks the migration of the iperf3 project to 201 | GitHub. Of particular interest: 202 | 203 | * Build / runtime fixes for CentOS 5, MacOS 10.9, and FreeBSD. 204 | 205 | * TCP snd_cwnd output on Linux in the default output format. 206 | 207 | * libiperf is now built as both a shared and static library; by 208 | default, the iperf3 binary links to the shared library. 209 | 210 | More information on changes can be found in the ``RELEASE_NOTES`` 211 | file in the source distribution. 212 | 213 | 2014-02-28: iperf migrated to GitHub 214 | ..................................... 215 | 216 | The new project page can be found at: 217 | 218 | https://github.com/esnet/iperf 219 | 220 | 2014-01-10: iperf-3.0.1 released 221 | ................................. 222 | 223 | | URL: http://stats.es.net/software/iperf-3.0.1.tar.gz 224 | | SHA256: ``32b419ef634dd7670328c3cecc158babf7d706bd4b3d248cf95965528a20e614 iperf-3.0.1.tar.gz`` 225 | 226 | During development, there were various distributions of the source 227 | code unofficially released carrying a 3.0.0 version number. Because 228 | of the possiblity for confusion, this first public release of iperf3 229 | was numbered 3.0.1. 230 | 231 | -------------------------------------------------------------------------------- /docs/obtaining.rst: -------------------------------------------------------------------------------- 1 | .. _obtaining: 2 | 3 | Obtaining iperf3 4 | ================ 5 | 6 | Binary Distributions 7 | -------------------- 8 | 9 | Binary packages are available for several supported operating systems: 10 | 11 | * FreeBSD: `benchmarks/iperf3 12 | `_ in the FreeBSD Ports Collection 13 | * Fedora / CentOS: `iperf3 14 | `_ and 15 | `iperf3-devel 16 | `_ in Fedora 17 | 19 and 20 and in Fedora EPEL 5, 6, and 7. 18 | 19 | Source Distributions 20 | -------------------- 21 | 22 | Source distributions of iperf are available as compressed (gzip) 23 | tarballs at: 24 | 25 | http://downloads.es.net/pub/iperf/ 26 | 27 | **Note:** Due to a software packaging error, the 3.0.2 release 28 | tarball was not compressed, even though its filename had a ``.tar.gz`` 29 | suffix. 30 | 31 | **Note:** GitHub, which currently hosts the iperf3 project, supports 32 | a "Releases" feature, which can automatically generate ``.zip`` or ``.tar.gz`` 33 | archives, on demand, from tags in the iperf3 source tree. These tags are 34 | created during the release engineering process to mark the exact 35 | version of files making up a release. 36 | 37 | In theory, the ``.tar.gz`` files produced by GitHub contain the same 38 | contents as what are in the official tarballs, note that the tarballs 39 | themselves will be different due to internal timestamps or other 40 | metadata. Therefore these files will *not* match the published SHA256 41 | checksums and no guarantees can be made about the integrity of the 42 | files. The authors of iperf3 always recommend downloading source 43 | distributions from the the directory above (or a mirror site), and 44 | verifying the SHA256 checksums before using them for any purpose, to 45 | ensure the files have not been tampered with. 46 | 47 | Source Code Repository 48 | ---------------------- 49 | 50 | The iperf3 project is hosted on GitHub at: 51 | 52 | https://github.com/esnet/iperf 53 | 54 | The iperf3 source code repository can be checked out directly from 55 | GitHub using: 56 | 57 | ``git clone https://github.com/esnet/iperf.git`` 58 | 59 | Primary development for iperf3 takes place on CentOS 6 Linux, FreeBSD 10, 60 | and MacOS X 10.8. At this time, these are the only officially supported 61 | platforms, however there have been some reports of success with 62 | OpenBSD, Android, and other Linux distributions. 63 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_PROGRAMS = mic mis # Build, but don't install 2 | 3 | AM_CPPFLAGS = -I$(top_srcdir)/src 4 | 5 | mic_SOURCES = mic.c 6 | mic_CFLAGS = -g 7 | mic_LDADD = ../src/libiperf.la 8 | mic_LDFLAGS = -g 9 | 10 | mis_SOURCES = mis.c 11 | mis_CFLAGS = -g 12 | mis_LDADD = ../src/libiperf.la 13 | mis_LDFLAGS = -g 14 | -------------------------------------------------------------------------------- /examples/mic.c: -------------------------------------------------------------------------------- 1 | #include "iperf_config.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #ifdef HAVE_STDINT_H 9 | #include 10 | #endif 11 | 12 | #include 13 | 14 | int 15 | main( int argc, char** argv ) 16 | { 17 | char* argv0; 18 | char* host; 19 | int port; 20 | struct iperf_test *test; 21 | 22 | argv0 = strrchr( argv[0], '/' ); 23 | if ( argv0 != (char*) 0 ) 24 | ++argv0; 25 | else 26 | argv0 = argv[0]; 27 | 28 | if ( argc != 3 ) { 29 | fprintf( stderr, "usage: %s [host] [port]\n", argv0 ); 30 | exit( EXIT_FAILURE ); 31 | } 32 | host = argv[1]; 33 | port = atoi( argv[2] ); 34 | 35 | test = iperf_new_test(); 36 | if ( test == NULL ) { 37 | fprintf( stderr, "%s: failed to create test\n", argv0 ); 38 | exit( EXIT_FAILURE ); 39 | } 40 | iperf_defaults( test ); 41 | iperf_set_verbose( test, 1 ); 42 | 43 | iperf_set_test_role( test, 'c' ); 44 | iperf_set_test_server_hostname( test, host ); 45 | iperf_set_test_server_port( test, port ); 46 | /* iperf_set_test_reverse( test, 1 ); */ 47 | iperf_set_test_omit( test, 3 ); 48 | iperf_set_test_duration( test, 5 ); 49 | iperf_set_test_reporter_interval( test, 1 ); 50 | iperf_set_test_stats_interval( test, 1 ); 51 | /* iperf_set_test_json_output( test, 1 ); */ 52 | 53 | if ( iperf_run_client( test ) < 0 ) { 54 | fprintf( stderr, "%s: error - %s\n", argv0, iperf_strerror( i_errno ) ); 55 | exit( EXIT_FAILURE ); 56 | } 57 | 58 | if (iperf_get_test_json_output_string(test)) { 59 | fprintf(iperf_get_test_outfile(test), "%zd bytes of JSON emitted\n", 60 | strlen(iperf_get_test_json_output_string(test))); 61 | } 62 | 63 | iperf_free_test( test ); 64 | exit( EXIT_SUCCESS ); 65 | } 66 | -------------------------------------------------------------------------------- /examples/mis.c: -------------------------------------------------------------------------------- 1 | #include "iperf_config.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #ifdef HAVE_STDINT_H 9 | #include 10 | #endif 11 | 12 | #include 13 | 14 | int 15 | main( int argc, char** argv ) 16 | { 17 | char* argv0; 18 | int port; 19 | struct iperf_test *test; 20 | int consecutive_errors; 21 | 22 | argv0 = strrchr( argv[0], '/' ); 23 | if ( argv0 != (char*) 0 ) 24 | ++argv0; 25 | else 26 | argv0 = argv[0]; 27 | 28 | if ( argc != 2 ) { 29 | fprintf( stderr, "usage: %s [port]\n", argv0 ); 30 | exit( EXIT_FAILURE ); 31 | } 32 | port = atoi( argv[1] ); 33 | 34 | test = iperf_new_test(); 35 | if ( test == NULL ) { 36 | fprintf( stderr, "%s: failed to create test\n", argv0 ); 37 | exit( EXIT_FAILURE ); 38 | } 39 | iperf_defaults( test ); 40 | iperf_set_verbose( test, 1 ); 41 | iperf_set_test_role( test, 's' ); 42 | iperf_set_test_server_port( test, port ); 43 | 44 | consecutive_errors = 0; 45 | for (;;) { 46 | if ( iperf_run_server( test ) < 0 ) { 47 | fprintf( stderr, "%s: error - %s\n\n", argv0, iperf_strerror( i_errno ) ); 48 | ++consecutive_errors; 49 | if (consecutive_errors >= 5) { 50 | fprintf(stderr, "%s: too many errors, exiting\n", argv0); 51 | break; 52 | } 53 | } else 54 | consecutive_errors = 0; 55 | iperf_reset_test( test ); 56 | } 57 | 58 | iperf_free_test( test ); 59 | exit( EXIT_SUCCESS ); 60 | } 61 | -------------------------------------------------------------------------------- /iperf3.spec.in: -------------------------------------------------------------------------------- 1 | Name: iperf3 2 | Version: @VERSION@ 3 | Release: 1%{?dist} 4 | Summary: Measurement tool for TCP/UDP bandwidth performance 5 | 6 | Group: Applications/Internet 7 | License: BSD 8 | URL: http://github.com/esnet/iperf 9 | Source0: http://stats.es.net/software/iperf-%{version}.tar.gz 10 | BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) 11 | 12 | %if 0%{?el5} 13 | BuildRequires: e2fsprogs-devel 14 | %endif 15 | 16 | %description 17 | Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of 18 | various parameters and UDP characteristics. Iperf reports bandwidth, delay 19 | jitter, data-gram loss. 20 | 21 | %package devel 22 | Summary: Development files for %{name} 23 | Group: Development/Libraries 24 | 25 | %description devel 26 | The %{name}-devel package contains libraries and header files for 27 | developing applications that use %{name}. 28 | 29 | %prep 30 | %setup -q -n iperf-%{version} 31 | 32 | %build 33 | %configure 34 | make %{?_smp_mflags} 35 | 36 | %install 37 | rm -rf $RPM_BUILD_ROOT 38 | %makeinstall -C src INSTALL_DIR="%{buildroot}%{_bindir}" 39 | mkdir -p %{buildroot}%{_mandir}/man1 40 | 41 | %clean 42 | rm -rf $RPM_BUILD_ROOT 43 | 44 | %files 45 | %defattr(-,root,root,-) 46 | %%doc README.md INSTALL LICENSE RELEASE_NOTES 47 | %{_mandir}/man1/iperf3.1.gz 48 | %{_mandir}/man3/libiperf.3.gz 49 | %{_bindir}/iperf3 50 | %{_libdir}/*.so.* 51 | 52 | %files devel 53 | %defattr(-,root,root,-) 54 | %{_includedir}/iperf_api.h 55 | %{_libdir}/libiperf.a 56 | %{_libdir}/libiperf.la 57 | %{_libdir}/*.so 58 | %{_libdir}/*.so.* 59 | 60 | %changelog 61 | * Fri Aug 29 2014 Aaron Brown 3.0.7-1 62 | - Update to 3.0.7 63 | 64 | * Tue Jul 29 2014 Aaron Brown 3.0.6-1 65 | - Update to 3.0.6 66 | 67 | * Mon Jun 16 2014 Aaron Brown 3.0.5-1 68 | - Update to 3.0.5 69 | 70 | * Wed Apr 2 2014 Susant Sahani 3.0.3-2 71 | - Moved static library to devel section only . 72 | 73 | * Sun Mar 30 2014 Susant Sahani 3.0.3-1 74 | - Update to 3.0.3 and added devel rpm support 75 | 76 | * Tue Mar 11 2014 Susant Sahani 3.0.2-1 77 | - Update to 3.0.2 78 | 79 | * Tue Jan 14 2014 Susant Sahani 3.0.1-1 80 | - Update to 3.0.1 81 | 82 | * Fri Oct 25 2013 Steven Roberts 3.0-1 83 | - Update to 3.0 84 | 85 | * Sat May 04 2013 Kevin Fenzi 3.0-0.4.b5 86 | - Update to 3.0b5 87 | 88 | * Thu Feb 14 2013 Fedora Release Engineering - 3.0-0.3.b4 89 | - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 90 | 91 | * Thu Jul 19 2012 Fedora Release Engineering - 3.0-0.2.b4 92 | - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 93 | 94 | * Fri Jan 13 2012 Fedora Release Engineering - 3.0-0.1.b4 95 | - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 96 | 97 | * Wed Apr 06 2011 G.Balaji 3.0b4-2 98 | - Changed the Spec name, removed static libs generation and devel 99 | - package. 100 | 101 | * Sat Mar 26 2011 G.Balaji 3.0b4-1 102 | - Initial Version 103 | 104 | -------------------------------------------------------------------------------- /src/cjson.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Dave Gamble 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #ifndef cJSON__h 24 | #define cJSON__h 25 | 26 | #ifdef __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | 31 | /* cJSON Types: */ 32 | #define cJSON_False 0 33 | #define cJSON_True 1 34 | #define cJSON_NULL 2 35 | #define cJSON_Number 3 36 | #define cJSON_String 4 37 | #define cJSON_Array 5 38 | #define cJSON_Object 6 39 | 40 | #define cJSON_IsReference 256 41 | 42 | /* The cJSON structure: */ 43 | typedef struct cJSON { 44 | struct cJSON *next, *prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ 45 | struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ 46 | 47 | int type; /* The type of the item, as above. */ 48 | 49 | char *valuestring; /* The item's string, if type==cJSON_String */ 50 | int64_t valueint; /* The item's number, if type==cJSON_Number */ 51 | double valuefloat; /* The item's number, if type==cJSON_Number */ 52 | 53 | char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ 54 | } cJSON; 55 | 56 | typedef struct cJSON_Hooks { 57 | void *(*malloc_fn)(size_t sz ); 58 | void (*free_fn)( void *ptr ); 59 | } cJSON_Hooks; 60 | 61 | /* Supply malloc, realloc and free functions to cJSON */ 62 | extern void cJSON_InitHooks( cJSON_Hooks* hooks ); 63 | 64 | 65 | /* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */ 66 | extern cJSON *cJSON_Parse( const char *value ); 67 | /* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */ 68 | extern char *cJSON_Print( cJSON *item ); 69 | /* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */ 70 | extern char *cJSON_PrintUnformatted( cJSON *item ); 71 | /* Delete a cJSON entity and all subentities. */ 72 | extern void cJSON_Delete( cJSON *c ); 73 | 74 | /* Returns the number of items in an array (or object). */ 75 | extern int cJSON_GetArraySize( cJSON *array ); 76 | /* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */ 77 | extern cJSON *cJSON_GetArrayItem( cJSON *array, int item ); 78 | /* Get item "string" from object. Case insensitive. */ 79 | extern cJSON *cJSON_GetObjectItem( cJSON *object, const char *string ); 80 | 81 | /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ 82 | extern const char *cJSON_GetErrorPtr( void ); 83 | 84 | /* These calls create a cJSON item of the appropriate type. */ 85 | extern cJSON *cJSON_CreateNull( void ); 86 | extern cJSON *cJSON_CreateTrue( void ); 87 | extern cJSON *cJSON_CreateFalse( void ); 88 | extern cJSON *cJSON_CreateBool( int b ); 89 | extern cJSON *cJSON_CreateInt( int64_t num ); 90 | extern cJSON *cJSON_CreateFloat( double num ); 91 | extern cJSON *cJSON_CreateString( const char *string ); 92 | extern cJSON *cJSON_CreateArray( void ); 93 | extern cJSON *cJSON_CreateObject( void ); 94 | 95 | /* These utilities create an Array of count items. */ 96 | extern cJSON *cJSON_CreateIntArray( int64_t *numbers, int count ); 97 | extern cJSON *cJSON_CreateFloatArray( double *numbers, int count ); 98 | extern cJSON *cJSON_CreateStringArray( const char **strings, int count ); 99 | 100 | /* Append item to the specified array/object. */ 101 | extern void cJSON_AddItemToArray( cJSON *array, cJSON *item ); 102 | extern void cJSON_AddItemToObject( cJSON *object, const char *string, cJSON *item ); 103 | /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ 104 | extern void cJSON_AddItemReferenceToArray( cJSON *array, cJSON *item ); 105 | extern void cJSON_AddItemReferenceToObject( cJSON *object, const char *string, cJSON *item ); 106 | 107 | /* Remove/Detatch items from Arrays/Objects. */ 108 | extern cJSON *cJSON_DetachItemFromArray( cJSON *array, int which ); 109 | extern void cJSON_DeleteItemFromArray( cJSON *array, int which ); 110 | extern cJSON *cJSON_DetachItemFromObject( cJSON *object, const char *string ); 111 | extern void cJSON_DeleteItemFromObject( cJSON *object, const char *string ); 112 | 113 | /* Update array items. */ 114 | extern void cJSON_ReplaceItemInArray( cJSON *array, int which, cJSON *newitem ); 115 | extern void cJSON_ReplaceItemInObject( cJSON *object, const char *string, cJSON *newitem ); 116 | 117 | #define cJSON_AddNullToObject( object, name ) cJSON_AddItemToObject( object, name, cJSON_CreateNull() ) 118 | #define cJSON_AddTrueToObject( object, name ) cJSON_AddItemToObject( object, name, cJSON_CreateTrue() ) 119 | #define cJSON_AddFalseToObject( object, name ) cJSON_AddItemToObject( object, name, cJSON_CreateFalse() ) 120 | #define cJSON_AddIntToObject( object, name, n ) cJSON_AddItemToObject( object, name, cJSON_CreateInt( n ) ) 121 | #define cJSON_AddFloatToObject( object, name, n ) cJSON_AddItemToObject( object, name, cJSON_CreateFloat( n ) ) 122 | #define cJSON_AddStringToObject( object, name, s ) cJSON_AddItemToObject( object, name, cJSON_CreateString( s ) ) 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /src/flowlabel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef __FLOW_LABEL_H 28 | #define __FLOW_LABEL_H 29 | 30 | 31 | #include 32 | 33 | /* 34 | It is just a stripped copy of the Linux kernel header "linux/in6.h" 35 | "Flow label" things are still not defined in "netinet/in*.h" headers, 36 | but we cannot use "linux/in6.h" immediately because it currently 37 | conflicts with "netinet/in.h" . 38 | */ 39 | 40 | #ifndef __ANDROID__ 41 | struct in6_flowlabel_req 42 | { 43 | struct in6_addr flr_dst; 44 | __u32 flr_label; 45 | __u8 flr_action; 46 | __u8 flr_share; 47 | __u16 flr_flags; 48 | __u16 flr_expires; 49 | __u16 flr_linger; 50 | __u32 __flr_pad; 51 | /* Options in format of IPV6_PKTOPTIONS */ 52 | }; 53 | #endif 54 | 55 | #define IPV6_FL_A_GET 0 56 | #define IPV6_FL_A_PUT 1 57 | #define IPV6_FL_A_RENEW 2 58 | 59 | #define IPV6_FL_F_CREATE 1 60 | #define IPV6_FL_F_EXCL 2 61 | 62 | #define IPV6_FL_S_NONE 0 63 | #define IPV6_FL_S_EXCL 1 64 | #define IPV6_FL_S_PROCESS 2 65 | #define IPV6_FL_S_USER 3 66 | #define IPV6_FL_S_ANY 255 67 | 68 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff 69 | #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 70 | 71 | #define IPV6_FLOWLABEL_MGR 32 72 | #define IPV6_FLOWINFO_SEND 33 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/iperf3.1: -------------------------------------------------------------------------------- 1 | .TH IPERF 1 "October 2015" ESnet "User Manuals" 2 | .SH NAME 3 | iperf3 \- perform network throughput tests 4 | .SH SYNOPSIS 5 | .B iperf3 -s [ 6 | .I options 7 | .B ] 8 | .br 9 | .B iperf3 -c 10 | .I server 11 | .B [ 12 | .I options 13 | .B ] 14 | 15 | .SH DESCRIPTION 16 | iperf3 is a tool for performing network throughput measurements. It can test 17 | either TCP or UDP throughput. To perform an iperf3 test the user must 18 | establish both a server and a client. 19 | 20 | .SH "GENERAL OPTIONS" 21 | .TP 22 | .BR -p ", " --port " \fIn\fR" 23 | set server port to listen on/connect to to \fIn\fR (default 5201) 24 | .TP 25 | .BR -f ", " --format " " 26 | [kmKM] format to report: Kbits, Mbits, KBytes, MBytes 27 | .TP 28 | .BR -i ", " --interval " \fIn\fR" 29 | pause \fIn\fR seconds between periodic bandwidth reports; 30 | default is 1, use 0 to disable 31 | .TP 32 | .BR -F ", " --file " \fIname\fR" 33 | client-side: read from the file and write to the network, instead 34 | of using random data; 35 | server-side: read from the network and write to the file, instead 36 | of throwing the data away 37 | .TP 38 | .BR -A ", " --affinity " \fIn/n,m\fR" 39 | Set the CPU affinity, if possible (Linux and FreeBSD only). 40 | On both the client and server you can set the local affinity by using 41 | the \fIn\fR form of this argument (where \fIn\fR is a CPU number). 42 | In addition, on the client side you can override the server's 43 | affinity for just that one test, using the \fIn,m\fR form of 44 | argument. 45 | Note that when using this feature, a process will only be bound 46 | to a single CPU (as opposed to a set containing potentialy multiple 47 | CPUs). 48 | .TP 49 | .BR -B ", " --bind " \fIhost\fR" 50 | bind to a specific interface 51 | .TP 52 | .BR -V ", " --verbose " " 53 | give more detailed output 54 | .TP 55 | .BR -J ", " --json " " 56 | output in JSON format 57 | .TP 58 | .BR --logfile " \fIfile\fR" 59 | send output to a log file. 60 | .TP 61 | .BR --forceflush " " 62 | force flushing output at every interval. 63 | Used to avoid buffering when sending output to pipe. 64 | .TP 65 | .BR -d ", " --debug " " 66 | emit debugging output. 67 | Primarily (perhaps exclusively) of use to developers. 68 | .TP 69 | .BR -v ", " --version " " 70 | show version information and quit 71 | .TP 72 | .BR -h ", " --help " " 73 | show a help synopsis 74 | 75 | .SH "SERVER SPECIFIC OPTIONS" 76 | .TP 77 | .BR -s ", " --server " " 78 | run in server mode 79 | .TP 80 | .BR -D ", " --daemon " " 81 | run the server in background as a daemon 82 | .TP 83 | .BR -I ", " --pidfile " \fIfile\fR" 84 | write a file with the process ID, most useful when running as a daemon. 85 | .TP 86 | .BR -1 ", " --one-off 87 | handle one client connection, then exit. 88 | 89 | .SH "CLIENT SPECIFIC OPTIONS" 90 | .TP 91 | .BR -c ", " --client " \fIhost\fR" 92 | run in client mode, connecting to the specified server 93 | .TP 94 | .BR --sctp 95 | use SCTP rather than TCP (FreeBSD and Linux) 96 | .TP 97 | .BR -u ", " --udp 98 | use UDP rather than TCP 99 | .TP 100 | .BR -b ", " --bandwidth " \fIn\fR[KM]" 101 | set target bandwidth to \fIn\fR bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP). 102 | If there are multiple streams (\-P flag), the bandwidth limit is applied 103 | separately to each stream. 104 | You can also add a '/' and a number to the bandwidth specifier. 105 | This is called "burst mode". 106 | It will send the given number of packets without pausing, even if that 107 | temporarily exceeds the specified bandwidth limit. 108 | Setting the target bandwidth to 0 will disable bandwidth limits 109 | (particularly useful for UDP tests). 110 | On platforms supporting the \fCSO_MAX_PACING_RATE\fR socket option 111 | (currently only Linux), fair-queueing socket-level pacing, implemented in 112 | the kernel, will be used. 113 | On other platforms, iperf3 will implement its own rate control. 114 | .TP 115 | .BR --no-fq-socket-pacing 116 | disable the use of fair-queueing based socket-level pacing with the -b 117 | option, and rely on iperf3's internal rate control. 118 | .TP 119 | .BR -t ", " --time " \fIn\fR" 120 | time in seconds to transmit for (default 10 secs) 121 | .TP 122 | .BR -n ", " --bytes " \fIn\fR[KM]" 123 | number of bytes to transmit (instead of \-t) 124 | .TP 125 | .BR -k ", " --blockcount " \fIn\fR[KM]" 126 | number of blocks (packets) to transmit (instead of \-t or \-n) 127 | .TP 128 | .BR -l ", " --length " \fIn\fR[KM]" 129 | length of buffer to read or write (default 128 KB for TCP, 8KB for UDP) 130 | .TP 131 | .BR --cport " \fIport\fR" 132 | bind data streams to a specific client port (for TCP and UDP only, 133 | default is to use an ephemeral port) 134 | .TP 135 | .BR -P ", " --parallel " \fIn\fR" 136 | number of parallel client streams to run 137 | .TP 138 | .BR -R ", " --reverse 139 | run in reverse mode (server sends, client receives) 140 | .TP 141 | .BR -w ", " --window " \fIn\fR[KM]" 142 | window size / socket buffer size (this gets sent to the server and used on that side too) 143 | .TP 144 | .BR -M ", " --set-mss " \fIn\fR" 145 | set TCP/SCTP maximum segment size (MTU - 40 bytes) 146 | .TP 147 | .BR -N ", " --no-delay " " 148 | set TCP/SCTP no delay, disabling Nagle's Algorithm 149 | .TP 150 | .BR -4 ", " --version4 " " 151 | only use IPv4 152 | .TP 153 | .BR -6 ", " --version6 " " 154 | only use IPv6 155 | .TP 156 | .BR -S ", " --tos " \fIn\fR" 157 | set the IP 'type of service' 158 | .TP 159 | .BR -L ", " --flowlabel " \fIn\fR" 160 | set the IPv6 flow label (currently only supported on Linux) 161 | .TP 162 | .BR -X ", " --xbind " \fIname\fR" 163 | Bind SCTP associations to a specific subset of links using sctp_bindx(3). 164 | The \fB--B\fR flag will be ignored if this flag is specified. 165 | Normally SCTP will include the protocol addresses of all active links 166 | on the local host when setting up an association. Specifying at least 167 | one \fB--X\fR name will disable this behaviour. 168 | This flag must be specified for each link to be included in the 169 | association, and is supported for both iperf servers and clients 170 | (the latter are supported by passing the first \fB--X\fR argument to bind(2)). 171 | Hostnames are accepted as arguments and are resolved using 172 | getaddrinfo(3). 173 | If the \fB--4\fR or \fB--6\fR flags are specified, names 174 | which do not resolve to addresses within the 175 | specified protocol family will be ignored. 176 | .TP 177 | .BR --nstreams " \fIn\fR" 178 | Set number of SCTP streams. 179 | .TP 180 | .BR -Z ", " --zerocopy " " 181 | Use a "zero copy" method of sending data, such as sendfile(2), 182 | instead of the usual write(2). 183 | .TP 184 | .BR -O ", " --omit " \fIn\fR" 185 | Omit the first n seconds of the test, to skip past the TCP slow-start 186 | period. 187 | .TP 188 | .BR -T ", " --title " \fIstr\fR" 189 | Prefix every output line with this string. 190 | .TP 191 | .BR -C ", " --congestion " \fIalgo\fR" 192 | Set the congestion control algorithm (Linux and FreeBSD only). An 193 | older 194 | .B --linux-congestion 195 | synonym for this flag is accepted but is deprecated. 196 | .TP 197 | .BR "--get-server-output" 198 | Get the output from the server. 199 | The output format is determined by the server (in particular, if the 200 | server was invoked with the \fB--json\fR flag, the output will be in 201 | JSON format, otherwise it will be in human-readable format). 202 | If the client is run with \fB--json\fR, the server output is included 203 | in a JSON object; otherwise it is appended at the bottom of the 204 | human-readable output. 205 | 206 | .SH AUTHORS 207 | A list of the contributors to iperf3 can be found within the 208 | documentation located at 209 | \fChttp://software.es.net/iperf/dev.html#authors\fR. 210 | 211 | .SH "SEE ALSO" 212 | libiperf(3), 213 | http://software.es.net/iperf 214 | -------------------------------------------------------------------------------- /src/iperf_config.h: -------------------------------------------------------------------------------- 1 | /* src/iperf_config.h. Generated from iperf_config.h.in by configure. */ 2 | /* src/iperf_config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the `cpuset_setaffinity' function. */ 5 | /* #undef HAVE_CPUSET_SETAFFINITY */ 6 | 7 | /* Have CPU affinity support. */ 8 | #define HAVE_CPU_AFFINITY 1 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #define HAVE_DLFCN_H 1 12 | 13 | /* Have IPv6 flowlabel support. */ 14 | #define HAVE_FLOWLABEL 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_INTTYPES_H 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_MEMORY_H 1 21 | 22 | /* Define to 1 if you have the `sched_setaffinity' function. */ 23 | #define HAVE_SCHED_SETAFFINITY 1 24 | 25 | /* Define to 1 if you have the `sendfile' function. */ 26 | #define HAVE_SENDFILE 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_STDINT_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_STDLIB_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_STRINGS_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_STRING_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_SYS_SOCKET_H 1 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #define HAVE_SYS_STAT_H 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_SYS_TYPES_H 1 48 | 49 | /* Have TCP_CONGESTION sockopt. */ 50 | #define HAVE_TCP_CONGESTION 1 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #define HAVE_UNISTD_H 1 54 | 55 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 56 | #define LT_OBJDIR ".libs/" 57 | 58 | /* Name of package */ 59 | #define PACKAGE "iperf" 60 | 61 | /* Define to the address where bug reports for this package should be sent. */ 62 | #define PACKAGE_BUGREPORT "https://github.com/esnet/iperf" 63 | 64 | /* Define to the full name of this package. */ 65 | #define PACKAGE_NAME "iperf" 66 | 67 | /* Define to the full name and version of this package. */ 68 | #define PACKAGE_STRING "iperf 3.1" 69 | 70 | /* Define to the one symbol short name of this package. */ 71 | #define PACKAGE_TARNAME "iperf" 72 | 73 | /* Define to the home page for this package. */ 74 | #define PACKAGE_URL "http://software.es.net/iperf/" 75 | 76 | /* Define to the version of this package. */ 77 | #define PACKAGE_VERSION "3.1" 78 | 79 | /* Define to 1 if you have the ANSI C header files. */ 80 | #define STDC_HEADERS 1 81 | 82 | /* Version number of package */ 83 | #define VERSION "3.1" 84 | 85 | /* Define to empty if `const' does not conform to ANSI C. */ 86 | /* #undef const */ 87 | -------------------------------------------------------------------------------- /src/iperf_config.h.in: -------------------------------------------------------------------------------- 1 | /* src/iperf_config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the `cpuset_setaffinity' function. */ 4 | #undef HAVE_CPUSET_SETAFFINITY 5 | 6 | /* Have CPU affinity support. */ 7 | #undef HAVE_CPU_AFFINITY 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_DLFCN_H 11 | 12 | /* Have IPv6 flowlabel support. */ 13 | #undef HAVE_FLOWLABEL 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_INTTYPES_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_MEMORY_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_NETINET_SCTP_H 23 | 24 | /* Define to 1 if you have the `sched_setaffinity' function. */ 25 | #undef HAVE_SCHED_SETAFFINITY 26 | 27 | /* Have SCTP support. */ 28 | #undef HAVE_SCTP 29 | 30 | /* Define to 1 if you have the `sendfile' function. */ 31 | #undef HAVE_SENDFILE 32 | 33 | /* Have SO_MAX_PACING_RATE sockopt. */ 34 | #undef HAVE_SO_MAX_PACING_RATE 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_STDINT_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_STDLIB_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_STRINGS_H 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_STRING_H 47 | 48 | /* Define to 1 if the system has the type `struct sctp_assoc_value'. */ 49 | #undef HAVE_STRUCT_SCTP_ASSOC_VALUE 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #undef HAVE_SYS_SOCKET_H 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #undef HAVE_SYS_STAT_H 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #undef HAVE_SYS_TYPES_H 59 | 60 | /* Have TCP_CONGESTION sockopt. */ 61 | #undef HAVE_TCP_CONGESTION 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #undef HAVE_UNISTD_H 65 | 66 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 67 | #undef LT_OBJDIR 68 | 69 | /* Name of package */ 70 | #undef PACKAGE 71 | 72 | /* Define to the address where bug reports for this package should be sent. */ 73 | #undef PACKAGE_BUGREPORT 74 | 75 | /* Define to the full name of this package. */ 76 | #undef PACKAGE_NAME 77 | 78 | /* Define to the full name and version of this package. */ 79 | #undef PACKAGE_STRING 80 | 81 | /* Define to the one symbol short name of this package. */ 82 | #undef PACKAGE_TARNAME 83 | 84 | /* Define to the home page for this package. */ 85 | #undef PACKAGE_URL 86 | 87 | /* Define to the version of this package. */ 88 | #undef PACKAGE_VERSION 89 | 90 | /* Define to 1 if you have the ANSI C header files. */ 91 | #undef STDC_HEADERS 92 | 93 | /* Version number of package */ 94 | #undef VERSION 95 | 96 | /* Define to empty if `const' does not conform to ANSI C. */ 97 | #undef const 98 | -------------------------------------------------------------------------------- /src/iperf_locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef IPERF_LOCALE_H 28 | #define IPERF_LOCALE_H 29 | 30 | extern const char usage_shortstr[]; 31 | extern const char usage_longstr[]; 32 | extern const char version[]; 33 | 34 | extern const char seperator_line[]; 35 | 36 | extern const char server_port[] ; 37 | extern const char client_port[] ; 38 | extern const char bind_address[] ; 39 | extern const char multicast_ttl[] ; 40 | extern const char join_multicast[] ; 41 | extern const char client_datagram_size[] ; 42 | extern const char server_datagram_size[] ; 43 | extern const char tcp_window_size[] ; 44 | extern const char udp_buffer_size[] ; 45 | extern const char window_default[] ; 46 | extern const char wait_server_threads[] ; 47 | extern const char test_start_time[]; 48 | extern const char test_start_bytes[]; 49 | extern const char test_start_blocks[]; 50 | 51 | extern const char report_time[] ; 52 | extern const char report_connecting[] ; 53 | extern const char report_reverse[] ; 54 | extern const char report_accepted[] ; 55 | extern const char report_cookie[] ; 56 | extern const char report_connected[] ; 57 | extern const char report_window[] ; 58 | extern const char report_autotune[] ; 59 | extern const char report_omit_done[] ; 60 | extern const char report_diskfile[] ; 61 | extern const char report_done[] ; 62 | extern const char report_read_lengths[] ; 63 | extern const char report_read_length_times[] ; 64 | extern const char report_bw_header[] ; 65 | extern const char report_bw_retrans_header[] ; 66 | extern const char report_bw_retrans_cwnd_header[] ; 67 | extern const char report_bw_udp_header[] ; 68 | extern const char report_bw_udp_sender_header[] ; 69 | extern const char report_bw_format[] ; 70 | extern const char report_bw_retrans_format[] ; 71 | extern const char report_bw_retrans_cwnd_format[] ; 72 | extern const char report_bw_udp_format[] ; 73 | extern const char report_bw_udp_sender_format[] ; 74 | extern const char report_summary[] ; 75 | extern const char report_sum_bw_format[] ; 76 | extern const char report_sum_bw_retrans_format[] ; 77 | extern const char report_sum_bw_udp_format[] ; 78 | extern const char report_sum_bw_udp_sender_format[] ; 79 | extern const char report_omitted[] ; 80 | extern const char report_bw_separator[] ; 81 | extern const char report_outoforder[] ; 82 | extern const char report_sum_outoforder[] ; 83 | extern const char report_peer[] ; 84 | extern const char report_mss_unsupported[] ; 85 | extern const char report_mss[] ; 86 | extern const char report_datagrams[] ; 87 | extern const char report_sum_datagrams[] ; 88 | extern const char server_reporting[] ; 89 | extern const char reportCSV_peer[] ; 90 | 91 | extern const char report_cpu[] ; 92 | extern const char report_local[] ; 93 | extern const char report_remote[] ; 94 | extern const char report_sender[] ; 95 | extern const char report_receiver[] ; 96 | 97 | extern const char report_tcpInfo[] ; 98 | extern const char report_tcpInfo[] ; 99 | 100 | 101 | extern const char warn_window_requested[] ; 102 | extern const char warn_window_small[] ; 103 | extern const char warn_delay_large[] ; 104 | extern const char warn_no_pathmtu[] ; 105 | extern const char warn_no_ack[]; 106 | extern const char warn_ack_failed[]; 107 | extern const char warn_fileopen_failed[]; 108 | extern const char unable_to_change_win[]; 109 | extern const char opt_estimate[]; 110 | extern const char report_interval_small[] ; 111 | extern const char warn_invalid_server_option[] ; 112 | extern const char warn_invalid_client_option[] ; 113 | extern const char warn_invalid_compatibility_option[] ; 114 | extern const char warn_implied_udp[] ; 115 | extern const char warn_implied_compatibility[] ; 116 | extern const char warn_buffer_too_small[] ; 117 | extern const char warn_invalid_single_threaded[] ; 118 | extern const char warn_invalid_report_style[] ; 119 | extern const char warn_invalid_report[] ; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /src/iperf_sctp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef IPERF_SCTP_H 28 | #define IPERF_SCTP_H 29 | 30 | /** 31 | * iperf_sctp_accept -- accepts a new SCTP connection 32 | * on sctp_listener_socket for SCTP data and param/result 33 | * exchange messages 34 | *returns 0 on success 35 | * 36 | */ 37 | int iperf_sctp_accept(struct iperf_test *); 38 | 39 | /** 40 | * iperf_sctp_recv -- receives the data for sctp 41 | * and the Param/result message exchange 42 | *returns state of packet received 43 | * 44 | */ 45 | int iperf_sctp_recv(struct iperf_stream *); 46 | 47 | 48 | /** 49 | * iperf_sctp_send -- sends the client data for sctp 50 | * and the Param/result message exchanges 51 | * returns: bytes sent 52 | * 53 | */ 54 | int iperf_sctp_send(struct iperf_stream *); 55 | 56 | 57 | int iperf_sctp_listen(struct iperf_test *); 58 | 59 | int iperf_sctp_connect(struct iperf_test *); 60 | 61 | int iperf_sctp_init(struct iperf_test *test); 62 | 63 | #define IPERF_SCTP_CLIENT 0 64 | #define IPERF_SCTP_SERVER 1 65 | 66 | int iperf_sctp_bindx(struct iperf_test *test, int s, int is_server); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/iperf_tcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef IPERF_TCP_H 28 | #define IPERF_TCP_H 29 | 30 | 31 | /** 32 | * iperf_tcp_accept -- accepts a new TCP connection 33 | * on tcp_listener_socket for TCP data and param/result 34 | * exchange messages 35 | *returns 0 on success 36 | * 37 | */ 38 | int iperf_tcp_accept(struct iperf_test *); 39 | 40 | /** 41 | * iperf_tcp_recv -- receives the data for TCP 42 | * and the Param/result message exchange 43 | *returns state of packet received 44 | * 45 | */ 46 | int iperf_tcp_recv(struct iperf_stream *); 47 | 48 | 49 | /** 50 | * iperf_tcp_send -- sends the client data for TCP 51 | * and the Param/result message exchanges 52 | * returns: bytes sent 53 | * 54 | */ 55 | int iperf_tcp_send(struct iperf_stream *) /* __attribute__((hot)) */; 56 | 57 | 58 | int iperf_tcp_listen(struct iperf_test *); 59 | 60 | int iperf_tcp_connect(struct iperf_test *); 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/iperf_udp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef __IPERF_UDP_H 28 | #define __IPERF_UDP_H 29 | 30 | 31 | /** 32 | * iperf_udp_recv -- receives the client data for UDP 33 | * 34 | *returns state of packet received 35 | * 36 | */ 37 | int iperf_udp_recv(struct iperf_stream *); 38 | 39 | /** 40 | * iperf_udp_send -- sends the client data for UDP 41 | * 42 | * returns: bytes sent 43 | * 44 | */ 45 | int iperf_udp_send(struct iperf_stream *) /* __attribute__((hot)) */; 46 | 47 | 48 | /** 49 | * iperf_udp_accept -- accepts a new UDP connection 50 | * on udp_listener_socket 51 | *returns 0 on success 52 | * 53 | */ 54 | int iperf_udp_accept(struct iperf_test *); 55 | 56 | 57 | int iperf_udp_listen(struct iperf_test *); 58 | 59 | int iperf_udp_connect(struct iperf_test *); 60 | 61 | int iperf_udp_init(struct iperf_test *); 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/iperf_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef __IPERF_UTIL_H 28 | #define __IPERF_UTIL_H 29 | 30 | #include "cjson.h" 31 | 32 | void make_cookie(char *); 33 | 34 | int is_closed(int); 35 | 36 | double timeval_to_double(struct timeval *tv); 37 | 38 | int timeval_equals(struct timeval *tv0, struct timeval *tv1); 39 | 40 | double timeval_diff(struct timeval *tv0, struct timeval *tv1); 41 | 42 | int delay(int64_t ns); 43 | 44 | void cpu_util(double pcpu[3]); 45 | 46 | const char* get_system_info(void); 47 | 48 | const char* get_optional_features(void); 49 | 50 | cJSON* iperf_json_printf(const char *format, ...); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/libiperf.3: -------------------------------------------------------------------------------- 1 | .TH LIBIPERF 3 "September 2015" ESnet "User Manuals" 2 | .SH NAME 3 | libiperf \- API for iperf3 network throughput tester 4 | 5 | .SH SYNOPSIS 6 | #include 7 | .br 8 | \-liperf 9 | 10 | .SH DESCRIPTION 11 | .PP 12 | Libiperf gives you access to all the functionality of the iperf3 13 | network testing tool. 14 | You can build it directly into your own program, instead of having 15 | to run it as a shell command. 16 | 17 | .SH CALLS 18 | Initialization / termination: 19 | .nf 20 | struct iperf_test *iperf_new_test(); 21 | int iperf_defaults(struct iperf_test *t); 22 | void iperf_free_test(struct iperf_test *t); 23 | .fi 24 | Setting test parameters: 25 | .nf 26 | void iperf_set_test_role( struct iperf_test *pt, char role ); 27 | void iperf_set_test_bind_address( struct iperf_test *t, char *bind_address ); 28 | void iperf_set_test_server_hostname( struct iperf_test *t, char *server_host ); 29 | void iperf_set_test_server_port( struct iperf_test *t, int server_port ); 30 | void iperf_set_test_duration( struct iperf_test *t, int duration ); 31 | void iperf_set_test_blksize( struct iperf_test *t, int blksize ); 32 | void iperf_set_test_num_streams( struct iperf_test *t, int num_streams ); 33 | void iperf_set_test_json_output( struct iperf_test *t, int json_output ); 34 | int iperf_has_zerocopy( void ); 35 | void iperf_set_test_zerocopy( struct iperf_test* t, int zerocopy ); 36 | .fi 37 | Running a test: 38 | .nf 39 | int iperf_run_client(struct iperf_test *); 40 | int iperf_run_server(struct iperf_test *); 41 | void iperf_test_reset(struct iperf_test *); 42 | .fi 43 | Output: 44 | .nf 45 | FILE *iperf_get_test_outfile(struct iperf_test *); 46 | char* iperf_get_test_json_output_string(struct iperf_test *); 47 | .fi 48 | Error reporting: 49 | .nf 50 | void iperf_err(struct iperf_test *t, const char *format, ...); 51 | char *iperf_strerror(int); 52 | extern int i_errno; 53 | .fi 54 | This is not a complete list of the available calls. 55 | See the include file for more. 56 | 57 | .SH EXAMPLES 58 | Here's some sample code that runs an iperf client: 59 | .nf 60 | struct iperf_test *test; 61 | test = iperf_new_test(); 62 | if ( test == NULL ) { 63 | fprintf( stderr, "%s: failed to create test\n", argv0 ); 64 | exit( EXIT_FAILURE ); 65 | } 66 | iperf_defaults( test ); 67 | iperf_set_test_role( test, 'c' ); 68 | iperf_set_test_server_hostname( test, host ); 69 | iperf_set_test_server_port( test, port ); 70 | if ( iperf_run_client( test ) < 0 ) { 71 | fprintf( stderr, "%s: error - %s\n", argv0, iperf_strerror( i_errno ) ); 72 | exit( EXIT_FAILURE ); 73 | } 74 | iperf_free_test( test ); 75 | .fi 76 | And here's a server: 77 | .nf 78 | struct iperf_test *test; 79 | test = iperf_new_test(); 80 | if ( test == NULL ) { 81 | fprintf( stderr, "%s: failed to create test\n", argv0 ); 82 | exit( EXIT_FAILURE ); 83 | } 84 | iperf_defaults( test ); 85 | iperf_set_test_role( test, 's' ); 86 | iperf_set_test_server_port( test, port ); 87 | for (;;) { 88 | if ( iperf_run_server( test ) < 0 ) 89 | fprintf( stderr, "%s: error - %s\n\n", argv0, iperf_strerror( i_errn 90 | o ) ); 91 | iperf_reset_test( test ); 92 | } 93 | iperf_free_test( test ); 94 | .fi 95 | These are not complete programs, just excerpts. 96 | The full runnable source code can be found in the examples subdirectory 97 | of the iperf3 source tree. 98 | 99 | .SH AUTHORS 100 | A list of the contributors to iperf3 can be found within the 101 | documentation located at 102 | \fChttp://software.es.net/iperf/dev.html#authors\fR. 103 | 104 | .SH "SEE ALSO" 105 | iperf3(1), 106 | http://software.es.net/iperf/ 107 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, 2015, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #include "iperf_config.h" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #ifdef HAVE_STDINT_H 37 | #include 38 | #endif 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #ifdef HAVE_STDINT_H 45 | #include 46 | #endif 47 | #include 48 | #include 49 | 50 | #include "iperf.h" 51 | #include "iperf_api.h" 52 | #include "units.h" 53 | #include "iperf_locale.h" 54 | #include "net.h" 55 | 56 | 57 | static int run(struct iperf_test *test); 58 | 59 | 60 | /**************************************************************************/ 61 | int 62 | main(int argc, char **argv) 63 | { 64 | struct iperf_test *test; 65 | 66 | // XXX: Setting the process affinity requires root on most systems. 67 | // Is this a feature we really need? 68 | #ifdef TEST_PROC_AFFINITY 69 | /* didnt seem to work.... */ 70 | /* 71 | * increasing the priority of the process to minimise packet generation 72 | * delay 73 | */ 74 | int rc = setpriority(PRIO_PROCESS, 0, -15); 75 | 76 | if (rc < 0) { 77 | perror("setpriority:"); 78 | fprintf(stderr, "setting priority to valid level\n"); 79 | rc = setpriority(PRIO_PROCESS, 0, 0); 80 | } 81 | 82 | /* setting the affinity of the process */ 83 | cpu_set_t cpu_set; 84 | int affinity = -1; 85 | int ncores = 1; 86 | 87 | sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set); 88 | if (errno) 89 | perror("couldn't get affinity:"); 90 | 91 | if ((ncores = sysconf(_SC_NPROCESSORS_CONF)) <= 0) 92 | err("sysconf: couldn't get _SC_NPROCESSORS_CONF"); 93 | 94 | CPU_ZERO(&cpu_set); 95 | CPU_SET(affinity, &cpu_set); 96 | if (sched_setaffinity(0, sizeof(cpu_set_t), &cpu_set) != 0) 97 | err("couldn't change CPU affinity"); 98 | #endif 99 | 100 | test = iperf_new_test(); 101 | if (!test) 102 | iperf_errexit(NULL, "create new test error - %s", iperf_strerror(i_errno)); 103 | iperf_defaults(test); /* sets defaults */ 104 | 105 | if (iperf_parse_arguments(test, argc, argv) < 0) { 106 | iperf_err(test, "parameter error - %s", iperf_strerror(i_errno)); 107 | fprintf(stderr, "\n"); 108 | usage_long(); 109 | exit(1); 110 | } 111 | 112 | #ifdef _HAVE_DPDK_ANS_ 113 | ans_mod_init(test->file_prefix); 114 | #endif 115 | 116 | if (run(test) < 0) 117 | iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); 118 | 119 | iperf_free_test(test); 120 | 121 | return 0; 122 | } 123 | 124 | 125 | static jmp_buf sigend_jmp_buf; 126 | 127 | static void 128 | sigend_handler(int sig) 129 | { 130 | longjmp(sigend_jmp_buf, 1); 131 | } 132 | 133 | /**************************************************************************/ 134 | static int 135 | run(struct iperf_test *test) 136 | { 137 | int consecutive_errors; 138 | 139 | /* Termination signals. */ 140 | iperf_catch_sigend(sigend_handler); 141 | if (setjmp(sigend_jmp_buf)) 142 | iperf_got_sigend(test); 143 | 144 | switch (test->role) { 145 | case 's': 146 | if (test->daemon) { 147 | int rc = daemon(0, 0); 148 | if (rc < 0) { 149 | i_errno = IEDAEMON; 150 | iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); 151 | } 152 | } 153 | consecutive_errors = 0; 154 | if (iperf_create_pidfile(test) < 0) { 155 | i_errno = IEPIDFILE; 156 | iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); 157 | } 158 | for (;;) { 159 | if (iperf_run_server(test) < 0) { 160 | iperf_err(test, "error - %s", iperf_strerror(i_errno)); 161 | ++consecutive_errors; 162 | if (consecutive_errors >= 5) { 163 | iperf_errexit(test, "too many errors, exiting"); 164 | break; 165 | } 166 | } else 167 | consecutive_errors = 0; 168 | iperf_reset_test(test); 169 | if (iperf_get_test_one_off(test)) 170 | break; 171 | } 172 | iperf_delete_pidfile(test); 173 | break; 174 | case 'c': 175 | if (iperf_run_client(test) < 0) 176 | iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); 177 | break; 178 | default: 179 | usage(); 180 | break; 181 | } 182 | 183 | iperf_catch_sigend(SIG_DFL); 184 | 185 | return 0; 186 | } 187 | -------------------------------------------------------------------------------- /src/net.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #ifndef __NET_H 28 | #define __NET_H 29 | 30 | int netdial(int domain, int proto, char *local, int local_port, char *server, int port); 31 | int netannounce(int domain, int proto, char *local, int port); 32 | int Nread(int fd, char *buf, size_t count, int prot); 33 | int Nwrite(int fd, const char *buf, size_t count, int prot) /* __attribute__((hot)) */; 34 | int has_sendfile(void); 35 | int Nsendfile(int fromfd, int tofd, const char *buf, size_t count) /* __attribute__((hot)) */; 36 | int getsock_tcp_mss(int inSock); 37 | int set_tcp_options(int sock, int no_delay, int mss); 38 | int setnonblocking(int fd, int nonblocking); 39 | int getsockdomain(int sock); 40 | 41 | #ifdef _HAVE_DPDK_ANS_ 42 | void ans_mod_init(char *file_prefix); 43 | #endif 44 | 45 | #define NET_SOFTERROR -1 46 | #define NET_HARDERROR -2 47 | 48 | #endif /* __NET_H */ 49 | -------------------------------------------------------------------------------- /src/portable_endian.h: -------------------------------------------------------------------------------- 1 | // "License": Public Domain 2 | // I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. 3 | 4 | #ifndef PORTABLE_ENDIAN_H__ 5 | #define PORTABLE_ENDIAN_H__ 6 | 7 | #if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) 8 | 9 | # define __WINDOWS__ 10 | 11 | #endif 12 | 13 | // GLIBC / Linux with endian(3) support, which was added in glibc 2.9. 14 | // Intended to support CentOS 6 and newer. 15 | #if defined(__linux__) && \ 16 | ((__GLIBC__ > 3) || \ 17 | (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9)) 18 | 19 | # include 20 | 21 | #elif defined(__CYGWIN__) 22 | 23 | # include 24 | 25 | #elif defined(__APPLE__) 26 | 27 | # include 28 | 29 | # define htobe16(x) OSSwapHostToBigInt16(x) 30 | # define htole16(x) OSSwapHostToLittleInt16(x) 31 | # define be16toh(x) OSSwapBigToHostInt16(x) 32 | # define le16toh(x) OSSwapLittleToHostInt16(x) 33 | 34 | # define htobe32(x) OSSwapHostToBigInt32(x) 35 | # define htole32(x) OSSwapHostToLittleInt32(x) 36 | # define be32toh(x) OSSwapBigToHostInt32(x) 37 | # define le32toh(x) OSSwapLittleToHostInt32(x) 38 | 39 | # define htobe64(x) OSSwapHostToBigInt64(x) 40 | # define htole64(x) OSSwapHostToLittleInt64(x) 41 | # define be64toh(x) OSSwapBigToHostInt64(x) 42 | # define le64toh(x) OSSwapLittleToHostInt64(x) 43 | 44 | # define __BYTE_ORDER BYTE_ORDER 45 | # define __BIG_ENDIAN BIG_ENDIAN 46 | # define __LITTLE_ENDIAN LITTLE_ENDIAN 47 | # define __PDP_ENDIAN PDP_ENDIAN 48 | 49 | #elif defined(__OpenBSD__) 50 | 51 | # include 52 | 53 | # define be16toh(x) betoh16(x) 54 | # define le16toh(x) letoh16(x) 55 | 56 | # define be32toh(x) betoh32(x) 57 | # define le32toh(x) letoh32(x) 58 | 59 | # define be64toh(x) betoh64(x) 60 | # define le64toh(x) letoh64(x) 61 | 62 | #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) 63 | 64 | # include 65 | 66 | #elif defined(__sun) && defined(__SVR4) 67 | 68 | # include 69 | # include 70 | # include 71 | 72 | # define be64toh(x) ntohll(x) 73 | # define htobe64(x) htonll(x) 74 | 75 | #elif defined(__WINDOWS__) 76 | 77 | # include 78 | # include 79 | 80 | # if BYTE_ORDER == LITTLE_ENDIAN 81 | 82 | # define htobe16(x) htons(x) 83 | # define htole16(x) (x) 84 | # define be16toh(x) ntohs(x) 85 | # define le16toh(x) (x) 86 | 87 | # define htobe32(x) htonl(x) 88 | # define htole32(x) (x) 89 | # define be32toh(x) ntohl(x) 90 | # define le32toh(x) (x) 91 | 92 | # define htobe64(x) htonll(x) 93 | # define htole64(x) (x) 94 | # define be64toh(x) ntohll(x) 95 | # define le64toh(x) (x) 96 | 97 | # elif BYTE_ORDER == BIG_ENDIAN 98 | 99 | /* that would be xbox 360 */ 100 | # define htobe16(x) (x) 101 | # define htole16(x) __builtin_bswap16(x) 102 | # define be16toh(x) (x) 103 | # define le16toh(x) __builtin_bswap16(x) 104 | 105 | # define htobe32(x) (x) 106 | # define htole32(x) __builtin_bswap32(x) 107 | # define be32toh(x) (x) 108 | # define le32toh(x) __builtin_bswap32(x) 109 | 110 | # define htobe64(x) (x) 111 | # define htole64(x) __builtin_bswap64(x) 112 | # define be64toh(x) (x) 113 | # define le64toh(x) __builtin_bswap64(x) 114 | 115 | # else 116 | 117 | # error byte order not supported 118 | 119 | # endif 120 | 121 | # define __BYTE_ORDER BYTE_ORDER 122 | # define __BIG_ENDIAN BIG_ENDIAN 123 | # define __LITTLE_ENDIAN LITTLE_ENDIAN 124 | # define __PDP_ENDIAN PDP_ENDIAN 125 | 126 | #else 127 | 128 | // Unsupported platforms. 129 | // Intended to support CentOS 5 but hopefully not too far from 130 | // the truth because we use the homebrew htonll, et al. implementations 131 | // that were originally the sole implementation of this functionality 132 | // in iperf 3.0. 133 | # warning platform not supported 134 | # include 135 | #if BYTE_ORDER == BIG_ENDIAN 136 | #define HTONLL(n) (n) 137 | #define NTOHLL(n) (n) 138 | #else 139 | #define HTONLL(n) ((((unsigned long long)(n) & 0xFF) << 56) | \ 140 | (((unsigned long long)(n) & 0xFF00) << 40) | \ 141 | (((unsigned long long)(n) & 0xFF0000) << 24) | \ 142 | (((unsigned long long)(n) & 0xFF000000) << 8) | \ 143 | (((unsigned long long)(n) & 0xFF00000000) >> 8) | \ 144 | (((unsigned long long)(n) & 0xFF0000000000) >> 24) | \ 145 | (((unsigned long long)(n) & 0xFF000000000000) >> 40) | \ 146 | (((unsigned long long)(n) & 0xFF00000000000000) >> 56)) 147 | 148 | #define NTOHLL(n) ((((unsigned long long)(n) & 0xFF) << 56) | \ 149 | (((unsigned long long)(n) & 0xFF00) << 40) | \ 150 | (((unsigned long long)(n) & 0xFF0000) << 24) | \ 151 | (((unsigned long long)(n) & 0xFF000000) << 8) | \ 152 | (((unsigned long long)(n) & 0xFF00000000) >> 8) | \ 153 | (((unsigned long long)(n) & 0xFF0000000000) >> 24) | \ 154 | (((unsigned long long)(n) & 0xFF000000000000) >> 40) | \ 155 | (((unsigned long long)(n) & 0xFF00000000000000) >> 56)) 156 | #endif 157 | 158 | #define htobe64(n) HTONLL(n) 159 | #define be64toh(n) NTOHLL(n) 160 | 161 | #endif 162 | 163 | #endif 164 | 165 | -------------------------------------------------------------------------------- /src/t_timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "timer.h" 33 | 34 | 35 | static int flag; 36 | 37 | 38 | static void 39 | timer_proc( TimerClientData client_data, struct timeval* nowP ) 40 | { 41 | flag = 1; 42 | } 43 | 44 | 45 | int 46 | main(int argc, char **argv) 47 | { 48 | Timer *tp; 49 | 50 | flag = 0; 51 | tp = tmr_create((struct timeval*) 0, timer_proc, JunkClientData, 3000000, 0); 52 | if (!tp) 53 | { 54 | printf("failed to create timer\n"); 55 | exit(-1); 56 | } 57 | 58 | sleep(2); 59 | 60 | tmr_run((struct timeval*) 0); 61 | if (flag) 62 | { 63 | printf("timer should not have expired\n"); 64 | exit(-1); 65 | } 66 | sleep(1); 67 | 68 | tmr_run((struct timeval*) 0); 69 | if (!flag) 70 | { 71 | printf("timer should have expired\n"); 72 | exit(-2); 73 | } 74 | 75 | tmr_destroy(); 76 | exit(0); 77 | } 78 | -------------------------------------------------------------------------------- /src/t_units.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #include 28 | #ifdef HAVE_STDINT_H 29 | #include 30 | #endif 31 | #include 32 | #include 33 | 34 | #include "iperf.h" 35 | #include "units.h" 36 | 37 | int 38 | main(int argc, char **argv) 39 | { 40 | iperf_size_t llu; 41 | double d; 42 | char s[11]; 43 | 44 | assert(1024.0 * 0.5 == unit_atof("0.5K")); 45 | assert(1024.0 == unit_atof("1K")); 46 | assert(1024.0 * 1024.0 == unit_atof("1M")); 47 | assert(4.0 * 1024.0 * 1024.0 * 1024.0 == unit_atof("4G")); 48 | 49 | #ifdef notdef 50 | /* Obsolete - we no longer make a distinction between upper and lower 51 | ** case. 52 | */ 53 | assert(1000.0 * 0.5 == unit_atof("0.5k")); 54 | assert(1000.0 == unit_atof("1k")); 55 | assert(1000.0 * 1000.0 == unit_atof("1m")); 56 | assert(4.0 * 1000.0 * 1000.0 * 1000.0 == unit_atof("4g")); 57 | #endif 58 | assert(1024.0 * 0.5 == unit_atof("0.5k")); 59 | assert(1024.0 == unit_atof("1k")); 60 | assert(1024.0 * 1024.0 == unit_atof("1m")); 61 | assert(4.0 * 1024.0 * 1024.0 * 1024.0 == unit_atof("4g")); 62 | 63 | assert(1024 * 0.5 == unit_atoi("0.5K")); 64 | assert(1024 == unit_atoi("1K")); 65 | assert(1024 * 1024 == unit_atoi("1M")); 66 | d = 4.0 * 1024 * 1024 * 1024; 67 | llu = (iperf_size_t) d; 68 | assert(llu == unit_atoi("4G")); 69 | 70 | #ifdef notdef 71 | /* Also obsolete. */ 72 | assert(1000 * 0.5 == unit_atoi("0.5k")); 73 | assert(1000 == unit_atoi("1k")); 74 | assert(1000 * 1000 == unit_atoi("1m")); 75 | d = 4.0 * 1000 * 1000 * 1000; 76 | llu = (iperf_size_t) d; 77 | assert(llu == unit_atoi("4g")); 78 | #endif 79 | assert(1024 * 0.5 == unit_atoi("0.5k")); 80 | assert(1024 == unit_atoi("1k")); 81 | assert(1024 * 1024 == unit_atoi("1m")); 82 | d = 4.0 * 1024 * 1024 * 1024; 83 | llu = (iperf_size_t) d; 84 | assert(llu == unit_atoi("4g")); 85 | 86 | unit_snprintf(s, 11, 1024.0, 'A'); 87 | assert(strncmp(s, "1.00 KByte", 11) == 0); 88 | 89 | unit_snprintf(s, 11, 1024.0 * 1024.0, 'A'); 90 | assert(strncmp(s, "1.00 MByte", 11) == 0); 91 | 92 | unit_snprintf(s, 11, 1000.0, 'k'); 93 | assert(strncmp(s, "8.00 Kbit", 11) == 0); 94 | 95 | unit_snprintf(s, 11, 1000.0 * 1000.0, 'a'); 96 | assert(strncmp(s, "8.00 Mbit", 11) == 0); 97 | 98 | d = 4.0 * 1024 * 1024 * 1024; 99 | unit_snprintf(s, 11, d, 'A'); 100 | assert(strncmp(s, "4.00 GByte", 11) == 0); 101 | 102 | unit_snprintf(s, 11, d, 'a'); 103 | assert(strncmp(s, "34.4 Gbit", 11) == 0); 104 | 105 | return 0; 106 | } 107 | -------------------------------------------------------------------------------- /src/t_uuid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "iperf_util.h" 33 | 34 | int 35 | main(int argc, char **argv) 36 | { 37 | char cookie[37]; 38 | make_cookie(cookie); 39 | printf("cookie: '%s'\n", cookie); 40 | if (strlen(cookie) != 36) 41 | { 42 | printf("Not 36 characters long!\n"); 43 | exit(-1); 44 | } 45 | exit(0); 46 | } 47 | -------------------------------------------------------------------------------- /src/tcp_info.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | 28 | /* 29 | * routines related to collection TCP_INFO using getsockopt() 30 | * 31 | * Brian Tierney, ESnet (bltierney@es.net) 32 | * 33 | * Note that this is only really useful on Linux. 34 | * XXX: only standard on linux versions 2.4 and later 35 | # 36 | * FreeBSD has a limitted implementation that only includes the following: 37 | * tcpi_snd_ssthresh, tcpi_snd_cwnd, tcpi_rcv_space, tcpi_rtt 38 | * Based on information on http://wiki.freebsd.org/8.0TODO, I dont think this will be 39 | * fixed before v8.1 at the earliest. 40 | * 41 | * OSX has no support. 42 | * 43 | * I think MS Windows does support TCP_INFO, but iperf3 does not currently support Windows. 44 | */ 45 | 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #include "iperf.h" 58 | #include "iperf_api.h" 59 | #include "iperf_locale.h" 60 | 61 | /*************************************************************/ 62 | int 63 | has_tcpinfo(void) 64 | { 65 | #if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)) \ 66 | && defined(TCP_INFO) 67 | return 1; 68 | #else 69 | return 0; 70 | #endif 71 | } 72 | 73 | /*************************************************************/ 74 | int 75 | has_tcpinfo_retransmits(void) 76 | { 77 | #if defined(linux) && defined(TCP_MD5SIG) 78 | /* TCP_MD5SIG doesn't actually have anything to do with TCP 79 | ** retransmits, it just showed up in the same rev of the header 80 | ** file. If it's present then struct tcp_info has the 81 | ** tcpi_total_retrans field that we need; if not, not. 82 | */ 83 | return 1; 84 | #else 85 | #if defined(__FreeBSD__) && __FreeBSD_version >= 600000 86 | return 1; /* Should work now */ 87 | #elif defined(__NetBSD__) && defined(TCP_INFO) 88 | return 1; 89 | #else 90 | return 0; 91 | #endif 92 | #endif 93 | } 94 | 95 | /*************************************************************/ 96 | void 97 | save_tcpinfo(struct iperf_stream *sp, struct iperf_interval_results *irp) 98 | { 99 | #if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)) && \ 100 | defined(TCP_INFO) 101 | socklen_t tcp_info_length = sizeof(struct tcp_info); 102 | int ret; 103 | 104 | /* ans return -2 */ 105 | ret = getsockopt(sp->socket, IPPROTO_TCP, TCP_INFO, (void *)&irp->tcpInfo, &tcp_info_length); 106 | if (ret < 0 && ret != -2) 107 | { 108 | iperf_err(sp->test, "getsockopt - %s", strerror(errno)); 109 | } 110 | if (sp->test->debug) { 111 | printf("tcpi_snd_cwnd %u tcpi_snd_mss %u tcpi_rtt %u\n", 112 | irp->tcpInfo.tcpi_snd_cwnd, irp->tcpInfo.tcpi_snd_mss, 113 | irp->tcpInfo.tcpi_rtt); 114 | } 115 | 116 | #endif 117 | } 118 | 119 | /*************************************************************/ 120 | long 121 | get_total_retransmits(struct iperf_interval_results *irp) 122 | { 123 | #if defined(linux) && defined(TCP_MD5SIG) 124 | return irp->tcpInfo.tcpi_total_retrans; 125 | #elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 126 | return irp->tcpInfo.tcpi_snd_rexmitpack; 127 | #elif defined(__NetBSD__) && defined(TCP_INFO) 128 | return irp->tcpInfo.tcpi_snd_rexmitpack; 129 | #else 130 | return -1; 131 | #endif 132 | } 133 | 134 | /*************************************************************/ 135 | /* 136 | * Return snd_cwnd in octets. 137 | */ 138 | long 139 | get_snd_cwnd(struct iperf_interval_results *irp) 140 | { 141 | #if defined(linux) && defined(TCP_MD5SIG) 142 | return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; 143 | #elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 144 | return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; 145 | #elif defined(__NetBSD__) && defined(TCP_INFO) 146 | return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; 147 | #else 148 | return -1; 149 | #endif 150 | } 151 | 152 | /*************************************************************/ 153 | /* 154 | * Return rtt in usec. 155 | */ 156 | long 157 | get_rtt(struct iperf_interval_results *irp) 158 | { 159 | #if defined(linux) && defined(TCP_MD5SIG) 160 | return irp->tcpInfo.tcpi_rtt; 161 | #elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 162 | return irp->tcpInfo.tcpi_rtt; 163 | #elif defined(__NetBSD__) && defined(TCP_INFO) 164 | return irp->tcpInfo.tcpi_rtt; 165 | #else 166 | return -1; 167 | #endif 168 | } 169 | 170 | /*************************************************************/ 171 | void 172 | build_tcpinfo_message(struct iperf_interval_results *r, char *message) 173 | { 174 | #if defined(linux) 175 | sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh, 176 | r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked, 177 | r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets, 178 | r->tcpInfo.tcpi_rtt, r->tcpInfo.tcpi_reordering); 179 | #endif 180 | #if defined(__FreeBSD__) 181 | sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, 182 | r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt); 183 | #endif 184 | #if defined(__NetBSD__) && defined(TCP_INFO) 185 | sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, 186 | r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt); 187 | #endif 188 | } 189 | -------------------------------------------------------------------------------- /src/tcp_window_size.c: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------- 2 | * Copyright (c) 1999,2000,2001,2002,2003 3 | * The Board of Trustees of the University of Illinois 4 | * All Rights Reserved. 5 | *--------------------------------------------------------------- 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software (Iperf) and associated 8 | * documentation files (the "Software"), to deal in the Software 9 | * without restriction, including without limitation the 10 | * rights to use, copy, modify, merge, publish, distribute, 11 | * sublicense, and/or sell copies of the Software, and to permit 12 | * persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * 16 | * Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and 18 | * the following disclaimers. 19 | * 20 | * 21 | * Redistributions in binary form must reproduce the above 22 | * copyright notice, this list of conditions and the following 23 | * disclaimers in the documentation and/or other materials 24 | * provided with the distribution. 25 | * 26 | * 27 | * Neither the names of the University of Illinois, NCSA, 28 | * nor the names of its contributors may be used to endorse 29 | * or promote products derived from this Software without 30 | * specific prior written permission. 31 | * 32 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 33 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 34 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 35 | * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT 36 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 37 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 38 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE 39 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 40 | * ________________________________________________________________ 41 | * National Laboratory for Applied Network Research 42 | * National Center for Supercomputing Applications 43 | * University of Illinois at Urbana-Champaign 44 | * http://www.ncsa.uiuc.edu 45 | * ________________________________________________________________ 46 | * 47 | * tcp_window_size.c 48 | * by Mark Gates 49 | * ------------------------------------------------------------------- 50 | * set/getsockopt 51 | * ------------------------------------------------------------------- */ 52 | 53 | /* 54 | * imported into iperfjd branch: 3 Feb 2009 jdugan 55 | * 56 | * made variable names more sane 57 | * removed some cruft 58 | */ 59 | 60 | #include 61 | #include 62 | #include 63 | 64 | /* ------------------------------------------------------------------- 65 | * If bufsize > 0, set the TCP window size (via the socket buffer 66 | * sizes) for sock. Otherwise leave it as the system default. 67 | * 68 | * This must be called prior to calling listen() or connect() on 69 | * the socket, for TCP window sizes > 64 KB to be effective. 70 | * 71 | * This now works on UNICOS also, by setting TCP_WINSHIFT. 72 | * This now works on AIX, by enabling RFC1323. 73 | * returns -1 on error, 0 on no error. 74 | * ------------------------------------------------------------------- 75 | */ 76 | 77 | int 78 | set_tcp_windowsize(int sock, int bufsize, int dir) 79 | { 80 | int rc; 81 | int newbufsize; 82 | 83 | assert(sock >= 0); 84 | 85 | if (bufsize > 0) 86 | { 87 | /* 88 | * note: results are verified after connect() or listen(), since 89 | * some OS's don't show the corrected value until then. 90 | */ 91 | // printf("Setting TCP buffer to size: %d\n", bufsize); 92 | newbufsize = bufsize; 93 | rc = setsockopt(sock, SOL_SOCKET, dir, (char *) &newbufsize, sizeof(newbufsize)); 94 | if (rc < 0) 95 | return rc; 96 | } else { 97 | // printf(" Using default TCP buffer size and assuming OS will do autotuning\n"); 98 | } 99 | 100 | return 0; 101 | } 102 | 103 | /* ------------------------------------------------------------------- 104 | * returns the TCP window size (on the sending buffer, SO_SNDBUF), 105 | * or -1 on error. 106 | * ------------------------------------------------------------------- */ 107 | 108 | int 109 | get_tcp_windowsize(int sock, int dir) 110 | { 111 | int bufsize = 0; 112 | 113 | int rc; 114 | socklen_t len; 115 | 116 | /* send buffer -- query for buffer size */ 117 | len = sizeof bufsize; 118 | rc = getsockopt(sock, SOL_SOCKET, dir, (char *) &bufsize, &len); 119 | 120 | if (rc < 0) 121 | return rc; 122 | 123 | return bufsize; 124 | } 125 | -------------------------------------------------------------------------------- /src/tcp_window_size.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | int set_tcp_windowsize(int sock, int bufsize, int dir); 28 | int get_tcp_windowsize(int sock, int dir); 29 | -------------------------------------------------------------------------------- /src/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | * 27 | * Based on timers.c by Jef Poskanzer. Used with permission. 28 | */ 29 | 30 | #include 31 | #include 32 | 33 | #include "timer.h" 34 | 35 | 36 | static Timer* timers = NULL; 37 | static Timer* free_timers = NULL; 38 | 39 | TimerClientData JunkClientData; 40 | 41 | 42 | 43 | /* This is an efficiency tweak. All the routines that need to know the 44 | ** current time get passed a pointer to a struct timeval. If it's non-NULL 45 | ** it gets used, otherwise we do our own gettimeofday() to fill it in. 46 | ** This lets the caller avoid extraneous gettimeofday()s when efficiency 47 | ** is needed, and not bother with the extra code when efficiency doesn't 48 | ** matter too much. 49 | */ 50 | static void 51 | getnow( struct timeval* nowP, struct timeval* nowP2 ) 52 | { 53 | if ( nowP != NULL ) 54 | *nowP2 = *nowP; 55 | else 56 | (void) gettimeofday( nowP2, NULL ); 57 | } 58 | 59 | 60 | static void 61 | list_add( Timer* t ) 62 | { 63 | Timer* t2; 64 | Timer* t2prev; 65 | 66 | if ( timers == NULL ) { 67 | /* The list is empty. */ 68 | timers = t; 69 | t->prev = t->next = NULL; 70 | } else { 71 | if ( t->time.tv_sec < timers->time.tv_sec || 72 | ( t->time.tv_sec == timers->time.tv_sec && 73 | t->time.tv_usec < timers->time.tv_usec ) ) { 74 | /* The new timer goes at the head of the list. */ 75 | t->prev = NULL; 76 | t->next = timers; 77 | timers->prev = t; 78 | timers = t; 79 | } else { 80 | /* Walk the list to find the insertion point. */ 81 | for ( t2prev = timers, t2 = timers->next; t2 != NULL; 82 | t2prev = t2, t2 = t2->next ) { 83 | if ( t->time.tv_sec < t2->time.tv_sec || 84 | ( t->time.tv_sec == t2->time.tv_sec && 85 | t->time.tv_usec < t2->time.tv_usec ) ) { 86 | /* Found it. */ 87 | t2prev->next = t; 88 | t->prev = t2prev; 89 | t->next = t2; 90 | t2->prev = t; 91 | return; 92 | } 93 | } 94 | /* Oops, got to the end of the list. Add to tail. */ 95 | t2prev->next = t; 96 | t->prev = t2prev; 97 | t->next = NULL; 98 | } 99 | } 100 | } 101 | 102 | 103 | static void 104 | list_remove( Timer* t ) 105 | { 106 | if ( t->prev == NULL ) 107 | timers = t->next; 108 | else 109 | t->prev->next = t->next; 110 | if ( t->next != NULL ) 111 | t->next->prev = t->prev; 112 | } 113 | 114 | 115 | static void 116 | list_resort( Timer* t ) 117 | { 118 | /* Remove the timer from the list. */ 119 | list_remove( t ); 120 | /* And add it back in, sorted correctly. */ 121 | list_add( t ); 122 | } 123 | 124 | 125 | static void 126 | add_usecs( struct timeval* t, int64_t usecs ) 127 | { 128 | t->tv_sec += usecs / 1000000L; 129 | t->tv_usec += usecs % 1000000L; 130 | if ( t->tv_usec >= 1000000L ) { 131 | t->tv_sec += t->tv_usec / 1000000L; 132 | t->tv_usec %= 1000000L; 133 | } 134 | } 135 | 136 | 137 | Timer* 138 | tmr_create( 139 | struct timeval* nowP, TimerProc* timer_proc, TimerClientData client_data, 140 | int64_t usecs, int periodic ) 141 | { 142 | struct timeval now; 143 | Timer* t; 144 | 145 | getnow( nowP, &now ); 146 | 147 | if ( free_timers != NULL ) { 148 | t = free_timers; 149 | free_timers = t->next; 150 | } else { 151 | t = (Timer*) malloc( sizeof(Timer) ); 152 | if ( t == NULL ) 153 | return NULL; 154 | } 155 | 156 | t->timer_proc = timer_proc; 157 | t->client_data = client_data; 158 | t->usecs = usecs; 159 | t->periodic = periodic; 160 | t->time = now; 161 | add_usecs( &t->time, usecs ); 162 | /* Add the new timer to the active list. */ 163 | list_add( t ); 164 | 165 | return t; 166 | } 167 | 168 | 169 | struct timeval* 170 | tmr_timeout( struct timeval* nowP ) 171 | { 172 | struct timeval now; 173 | int64_t usecs; 174 | static struct timeval timeout; 175 | 176 | getnow( nowP, &now ); 177 | /* Since the list is sorted, we only need to look at the first timer. */ 178 | if ( timers == NULL ) 179 | return NULL; 180 | usecs = ( timers->time.tv_sec - now.tv_sec ) * 1000000LL + 181 | ( timers->time.tv_usec - now.tv_usec ); 182 | if ( usecs <= 0 ) 183 | usecs = 0; 184 | timeout.tv_sec = usecs / 1000000LL; 185 | timeout.tv_usec = usecs % 1000000LL; 186 | return &timeout; 187 | } 188 | 189 | 190 | void 191 | tmr_run( struct timeval* nowP ) 192 | { 193 | struct timeval now; 194 | Timer* t; 195 | Timer* next; 196 | 197 | getnow( nowP, &now ); 198 | for ( t = timers; t != NULL; t = next ) { 199 | next = t->next; 200 | /* Since the list is sorted, as soon as we find a timer 201 | ** that isn't ready yet, we are done. 202 | */ 203 | if ( t->time.tv_sec > now.tv_sec || 204 | ( t->time.tv_sec == now.tv_sec && 205 | t->time.tv_usec > now.tv_usec ) ) 206 | break; 207 | (t->timer_proc)( t->client_data, &now ); 208 | if ( t->periodic ) { 209 | /* Reschedule. */ 210 | add_usecs( &t->time, t->usecs ); 211 | list_resort( t ); 212 | } else 213 | tmr_cancel( t ); 214 | } 215 | } 216 | 217 | 218 | void 219 | tmr_reset( struct timeval* nowP, Timer* t ) 220 | { 221 | struct timeval now; 222 | 223 | getnow( nowP, &now ); 224 | t->time = now; 225 | add_usecs( &t->time, t->usecs ); 226 | list_resort( t ); 227 | } 228 | 229 | 230 | void 231 | tmr_cancel( Timer* t ) 232 | { 233 | /* Remove it from the active list. */ 234 | list_remove( t ); 235 | /* And put it on the free list. */ 236 | t->next = free_timers; 237 | free_timers = t; 238 | t->prev = NULL; 239 | } 240 | 241 | 242 | void 243 | tmr_cleanup( void ) 244 | { 245 | Timer* t; 246 | 247 | while ( free_timers != NULL ) { 248 | t = free_timers; 249 | free_timers = t->next; 250 | free( (void*) t ); 251 | } 252 | } 253 | 254 | 255 | void 256 | tmr_destroy( void ) 257 | { 258 | while ( timers != NULL ) 259 | tmr_cancel( timers ); 260 | tmr_cleanup(); 261 | } 262 | -------------------------------------------------------------------------------- /src/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | * 27 | * Based on timers.h by Jef Poskanzer. Used with permission. 28 | */ 29 | 30 | #ifndef __TIMER_H 31 | #define __TIMER_H 32 | 33 | #include 34 | 35 | /* TimerClientData is an opaque value that tags along with a timer. The 36 | ** client can use it for whatever, and it gets passed to the callback when 37 | ** the timer triggers. 38 | */ 39 | typedef union 40 | { 41 | void* p; 42 | int i; 43 | long l; 44 | } TimerClientData; 45 | 46 | extern TimerClientData JunkClientData; /* for use when you don't care */ 47 | 48 | /* The TimerProc gets called when the timer expires. It gets passed 49 | ** the TimerClientData associated with the timer, and a timeval in case 50 | ** it wants to schedule another timer. 51 | */ 52 | typedef void TimerProc( TimerClientData client_data, struct timeval* nowP ); 53 | 54 | /* The Timer struct. */ 55 | typedef struct TimerStruct 56 | { 57 | TimerProc* timer_proc; 58 | TimerClientData client_data; 59 | int64_t usecs; 60 | int periodic; 61 | struct timeval time; 62 | struct TimerStruct* prev; 63 | struct TimerStruct* next; 64 | int hash; 65 | } Timer; 66 | 67 | /* Set up a timer, either periodic or one-shot. Returns (Timer*) 0 on errors. */ 68 | extern Timer* tmr_create( 69 | struct timeval* nowP, TimerProc* timer_proc, TimerClientData client_data, 70 | int64_t usecs, int periodic ); 71 | 72 | /* Returns a timeout indicating how long until the next timer triggers. You 73 | ** can just put the call to this routine right in your select(). Returns 74 | ** (struct timeval*) 0 if no timers are pending. 75 | */ 76 | extern struct timeval* tmr_timeout( struct timeval* nowP ) /* __attribute__((hot)) */; 77 | 78 | /* Run the list of timers. Your main program needs to call this every so often, 79 | ** or as indicated by tmr_timeout(). 80 | */ 81 | extern void tmr_run( struct timeval* nowP ) /* __attribute__((hot)) */; 82 | 83 | /* Reset the clock on a timer, to current time plus the original timeout. */ 84 | extern void tmr_reset( struct timeval* nowP, Timer* timer ); 85 | 86 | /* Deschedule a timer. Note that non-periodic timers are automatically 87 | ** descheduled when they run, so you don't have to call this on them. 88 | */ 89 | extern void tmr_cancel( Timer* timer ); 90 | 91 | /* Clean up the timers package, freeing any unused storage. */ 92 | extern void tmr_cleanup( void ); 93 | 94 | /* Cancel all timers and free storage, usually in preparation for exiting. */ 95 | extern void tmr_destroy( void ); 96 | 97 | #endif /* __TIMER_H */ 98 | -------------------------------------------------------------------------------- /src/units.c: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------- 2 | * Copyright (c) 1999,2000,2001,2002,2003 3 | * The Board of Trustees of the University of Illinois 4 | * All Rights Reserved. 5 | *--------------------------------------------------------------- 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software (Iperf) and associated 8 | * documentation files (the "Software"), to deal in the Software 9 | * without restriction, including without limitation the 10 | * rights to use, copy, modify, merge, publish, distribute, 11 | * sublicense, and/or sell copies of the Software, and to permit 12 | * persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * 16 | * Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and 18 | * the following disclaimers. 19 | * 20 | * 21 | * Redistributions in binary form must reproduce the above 22 | * copyright notice, this list of conditions and the following 23 | * disclaimers in the documentation and/or other materials 24 | * provided with the distribution. 25 | * 26 | * 27 | * Neither the names of the University of Illinois, NCSA, 28 | * nor the names of its contributors may be used to endorse 29 | * or promote products derived from this Software without 30 | * specific prior written permission. 31 | * 32 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 33 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 34 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 35 | * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT 36 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 37 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 38 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE 39 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 40 | * ________________________________________________________________ 41 | * National Laboratory for Applied Network Research 42 | * National Center for Supercomputing Applications 43 | * University of Illinois at Urbana-Champaign 44 | * http://www.ncsa.uiuc.edu 45 | * ________________________________________________________________ 46 | * 47 | * stdio.c 48 | * by Mark Gates 49 | * and Ajay Tirumalla 50 | * ------------------------------------------------------------------- 51 | * input and output numbers, converting with kilo, mega, giga 52 | * ------------------------------------------------------------------- */ 53 | 54 | #include 55 | #include 56 | #include 57 | #ifdef HAVE_STDINT_H 58 | #include 59 | #endif 60 | #include 61 | #include 62 | #include 63 | #include 64 | 65 | 66 | #include "iperf.h" 67 | 68 | #ifdef __cplusplus 69 | extern "C" 70 | { 71 | #endif 72 | 73 | const long KILO_UNIT = 1024; 74 | const long MEGA_UNIT = 1024 * 1024; 75 | const long GIGA_UNIT = 1024 * 1024 * 1024; 76 | 77 | const long KILO_RATE_UNIT = 1000; 78 | const long MEGA_RATE_UNIT = 1000 * 1000; 79 | const long GIGA_RATE_UNIT = 1000 * 1000 * 1000; 80 | 81 | /* ------------------------------------------------------------------- 82 | * unit_atof 83 | * 84 | * Given a string of form #x where # is a number and x is a format 85 | * character listed below, this returns the interpreted integer. 86 | * Gg, Mm, Kk are giga, mega, kilo respectively 87 | * ------------------------------------------------------------------- */ 88 | 89 | double unit_atof(const char *s) 90 | { 91 | double n; 92 | char suffix = '\0'; 93 | 94 | assert(s != NULL); 95 | 96 | /* scan the number and any suffices */ 97 | sscanf(s, "%lf%c", &n, &suffix); 98 | 99 | /* convert according to [Gg Mm Kk] */ 100 | switch (suffix) 101 | { 102 | case 'g': case 'G': 103 | n *= GIGA_UNIT; 104 | break; 105 | case 'm': case 'M': 106 | n *= MEGA_UNIT; 107 | break; 108 | case 'k': case 'K': 109 | n *= KILO_UNIT; 110 | break; 111 | default: 112 | break; 113 | } 114 | return n; 115 | } /* end unit_atof */ 116 | 117 | 118 | /* ------------------------------------------------------------------- 119 | * unit_atof_rate 120 | * 121 | * Similar to unit_atof, but uses 10-based rather than 2-based 122 | * suffixes. 123 | * ------------------------------------------------------------------- */ 124 | 125 | double unit_atof_rate(const char *s) 126 | { 127 | double n; 128 | char suffix = '\0'; 129 | 130 | assert(s != NULL); 131 | 132 | /* scan the number and any suffices */ 133 | sscanf(s, "%lf%c", &n, &suffix); 134 | 135 | /* convert according to [Gg Mm Kk] */ 136 | switch (suffix) 137 | { 138 | case 'g': case 'G': 139 | n *= GIGA_RATE_UNIT; 140 | break; 141 | case 'm': case 'M': 142 | n *= MEGA_RATE_UNIT; 143 | break; 144 | case 'k': case 'K': 145 | n *= KILO_RATE_UNIT; 146 | break; 147 | default: 148 | break; 149 | } 150 | return n; 151 | } /* end unit_atof_rate */ 152 | 153 | 154 | 155 | /* ------------------------------------------------------------------- 156 | * unit_atoi 157 | * 158 | * Given a string of form #x where # is a number and x is a format 159 | * character listed below, this returns the interpreted integer. 160 | * Gg, Mm, Kk are giga, mega, kilo respectively 161 | * ------------------------------------------------------------------- */ 162 | 163 | iperf_size_t unit_atoi(const char *s) 164 | { 165 | double n; 166 | char suffix = '\0'; 167 | 168 | assert(s != NULL); 169 | 170 | /* scan the number and any suffices */ 171 | sscanf(s, "%lf%c", &n, &suffix); 172 | 173 | /* convert according to [Gg Mm Kk] */ 174 | switch (suffix) 175 | { 176 | case 'g': case 'G': 177 | n *= GIGA_UNIT; 178 | break; 179 | case 'm': case 'M': 180 | n *= MEGA_UNIT; 181 | break; 182 | case 'k': case 'K': 183 | n *= KILO_UNIT; 184 | break; 185 | default: 186 | break; 187 | } 188 | return (iperf_size_t) n; 189 | } /* end unit_atof */ 190 | 191 | /* ------------------------------------------------------------------- 192 | * constants for byte_printf 193 | * ------------------------------------------------------------------- */ 194 | 195 | /* used as indices into conversion_bytes[], label_byte[], and label_bit[] */ 196 | enum 197 | { 198 | UNIT_CONV, 199 | KILO_CONV, 200 | MEGA_CONV, 201 | GIGA_CONV 202 | }; 203 | 204 | /* factor to multiply the number by */ 205 | const double conversion_bytes[] = 206 | { 207 | 1.0, /* unit */ 208 | 1.0 / 1024, /* kilo */ 209 | 1.0 / 1024 / 1024, /* mega */ 210 | 1.0 / 1024 / 1024 / 1024/* giga */ 211 | }; 212 | 213 | /* factor to multiply the number by for bits*/ 214 | const double conversion_bits[] = 215 | { 216 | 1.0, /* unit */ 217 | 1.0 / 1000, /* kilo */ 218 | 1.0 / 1000 / 1000, /* mega */ 219 | 1.0 / 1000 / 1000 / 1000/* giga */ 220 | }; 221 | 222 | 223 | /* labels for Byte formats [KMG] */ 224 | const char *label_byte[] = 225 | { 226 | "Byte", 227 | "KByte", 228 | "MByte", 229 | "GByte" 230 | }; 231 | 232 | /* labels for bit formats [kmg] */ 233 | const char *label_bit[] = 234 | { 235 | "bit", 236 | "Kbit", 237 | "Mbit", 238 | "Gbit" 239 | }; 240 | 241 | /* ------------------------------------------------------------------- 242 | * unit_snprintf 243 | * 244 | * Given a number in bytes and a format, converts the number and 245 | * prints it out with a bits or bytes label. 246 | * B, K, M, G, A for Byte, Kbyte, Mbyte, Gbyte, adaptive byte 247 | * b, k, m, g, a for bit, Kbit, Mbit, Gbit, adaptive bit 248 | * adaptive picks the "best" one based on the number. 249 | * s should be at least 11 chars long 250 | * (4 digits + space + 5 chars max + null) 251 | * ------------------------------------------------------------------- */ 252 | 253 | void unit_snprintf(char *s, int inLen, 254 | double inNum, char inFormat) 255 | { 256 | int conv; 257 | const char *suffix; 258 | const char *format; 259 | 260 | /* convert to bits for [bkmga] */ 261 | if (!isupper((int) inFormat)) 262 | { 263 | inNum *= 8; 264 | } 265 | switch (toupper((u_char)inFormat)) 266 | { 267 | case 'B': 268 | conv = UNIT_CONV; 269 | break; 270 | case 'K': 271 | conv = KILO_CONV; 272 | break; 273 | case 'M': 274 | conv = MEGA_CONV; 275 | break; 276 | case 'G': 277 | conv = GIGA_CONV; 278 | break; 279 | 280 | default: 281 | case 'A': 282 | { 283 | double tmpNum = inNum; 284 | conv = UNIT_CONV; 285 | 286 | if (isupper((int) inFormat)) 287 | { 288 | while (tmpNum >= 1024.0 && conv <= GIGA_CONV) 289 | { 290 | tmpNum /= 1024.0; 291 | conv++; 292 | } 293 | } else 294 | { 295 | while (tmpNum >= 1000.0 && conv <= GIGA_CONV) 296 | { 297 | tmpNum /= 1000.0; 298 | conv++; 299 | } 300 | } 301 | break; 302 | } 303 | } 304 | 305 | if (!isupper((int) inFormat)) 306 | { 307 | inNum *= conversion_bits[conv]; 308 | suffix = label_bit[conv]; 309 | } else 310 | { 311 | inNum *= conversion_bytes[conv]; 312 | suffix = label_byte[conv]; 313 | } 314 | 315 | /* print such that we always fit in 4 places */ 316 | if (inNum < 9.995) 317 | { /* 9.995 would be rounded to 10.0 */ 318 | format = "%4.2f %s";/* #.## */ 319 | } else if (inNum < 99.95) 320 | { /* 99.95 would be rounded to 100 */ 321 | format = "%4.1f %s";/* ##.# */ 322 | } else if (inNum < 999.5) 323 | { /* 999.5 would be rounded to 1000 */ 324 | format = "%4.0f %s";/* ### */ 325 | } else 326 | { /* 1000-1024 fits in 4 places If not using 327 | * Adaptive sizes then this code will not 328 | * control spaces */ 329 | format = "%4.0f %s";/* #### */ 330 | } 331 | snprintf(s, inLen, format, inNum, suffix); 332 | } /* end unit_snprintf */ 333 | 334 | #ifdef __cplusplus 335 | } /* end extern "C" */ 336 | 337 | #endif 338 | -------------------------------------------------------------------------------- /src/units.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | enum { 28 | UNIT_LEN = 32 29 | }; 30 | 31 | double unit_atof( const char *s ); 32 | double unit_atof_rate( const char *s ); 33 | iperf_size_t unit_atoi( const char *s ); 34 | void unit_snprintf( char *s, int inLen, double inNum, char inFormat ); 35 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #define IPERF_VERSION "3.1" 28 | -------------------------------------------------------------------------------- /src/version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * iperf, Copyright (c) 2014, The Regents of the University of 3 | * California, through Lawrence Berkeley National Laboratory (subject 4 | * to receipt of any required approvals from the U.S. Dept. of 5 | * Energy). All rights reserved. 6 | * 7 | * If you have questions about your rights to use or distribute this 8 | * software, please contact Berkeley Lab's Technology Transfer 9 | * Department at TTD@lbl.gov. 10 | * 11 | * NOTICE. This software is owned by the U.S. Department of Energy. 12 | * As such, the U.S. Government has been granted for itself and others 13 | * acting on its behalf a paid-up, nonexclusive, irrevocable, 14 | * worldwide license in the Software to reproduce, prepare derivative 15 | * works, and perform publicly and display publicly. Beginning five 16 | * (5) years after the date permission to assert copyright is obtained 17 | * from the U.S. Department of Energy, and subject to any subsequent 18 | * five (5) year renewals, the U.S. Government is granted for itself 19 | * and others acting on its behalf a paid-up, nonexclusive, 20 | * irrevocable, worldwide license in the Software to reproduce, 21 | * prepare derivative works, distribute copies to the public, perform 22 | * publicly and display publicly, and to permit others to do so. 23 | * 24 | * This code is distributed under a BSD style license, see the LICENSE 25 | * file for complete information. 26 | */ 27 | #define IPERF_VERSION "@PACKAGE_VERSION@" 28 | -------------------------------------------------------------------------------- /test_commands.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This is a set of commands to run and verify they work before doing a new release. 4 | # Eventually they should also use the -J flag to generate JSON output, and a program should 5 | # be written to check the output. 6 | # Be sure to test both client and server on Linux, BSD, and OSX 7 | # 8 | 9 | if [ $# -ne 1 ] 10 | then 11 | echo "Usage: `basename $0` hostname" 12 | exit $E_BADARGS 13 | fi 14 | 15 | set -x 16 | 17 | host=$1 18 | 19 | # basic testing 20 | ./src/iperf3 -c $host -V -t 5 -T "test1" 21 | ./src/iperf3 -c $host -u -V -t 5 22 | # omit mode 23 | ./src/iperf3 -c $host -i .3 -O 2 -t 5 24 | # JSON mode 25 | ./src/iperf3 -c $host -i 1 -J -t 5 26 | # force V4 27 | ./src/iperf3 -c $host -4 -t 5 28 | ./src/iperf3 -c $host -4 -u -t 5 29 | # force V6 30 | ./src/iperf3 -c $host -6 -t 5 31 | ./src/iperf3 -c $host -6 -u -t 5 32 | # parallel streams 33 | ./src/iperf3 -c $host -P 3 -t 5 34 | ./src/iperf3 -c $host -u -P 3 -t 5 35 | # reverse mode 36 | ./src/iperf3 -c $host -P 2 -t 5 -R 37 | ./src/iperf3 -c $host -u -P 2 -t 5 -R 38 | # zero copy 39 | ./src/iperf3 -c $host -Z -t 5 40 | ./src/iperf3 -c $host -Z -t 5 -R 41 | # window size 42 | ./src/iperf3 -c $host -t 5 -w 8M 43 | # -n flag 44 | ./src/iperf3 -c $host -n 5M 45 | ./src/iperf3 -c $host -n 5M -u -b1G 46 | # conflicting -n -t flags 47 | ./src/iperf3 -c $host -n 5M -t 5 48 | # -k mode 49 | ./src/iperf3 -c $host -k 1K 50 | ./src/iperf3 -c $host -k 1K -u -b1G 51 | # CPU affinity 52 | ./src/iperf3 -c $host -A 2/2 53 | ./src/iperf3 -c $host -A 2/2 -u -b1G 54 | # Burst mode 55 | ./src/iperf3 -c $host -u -b1G/100 56 | # change MSS 57 | ./src/iperf3 -c $host -M 1000 -V 58 | # test congestion control option (linux only) 59 | ./src/iperf3 -c $host -C reno -V 60 | 61 | 62 | --------------------------------------------------------------------------------