├── timers.c ├── timers.h ├── http_load.1 ├── http_load.c ├── FILES ├── version.h ├── README ├── make_test_files ├── Makefile └── port.h /timers.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timbunce/http_load/HEAD/timers.c -------------------------------------------------------------------------------- /timers.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timbunce/http_load/HEAD/timers.h -------------------------------------------------------------------------------- /http_load.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timbunce/http_load/HEAD/http_load.1 -------------------------------------------------------------------------------- /http_load.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timbunce/http_load/HEAD/http_load.c -------------------------------------------------------------------------------- /FILES: -------------------------------------------------------------------------------- 1 | Makefile 2 | README 3 | http_load.1 4 | http_load.c 5 | make_test_files 6 | port.h 7 | timers.c 8 | timers.h 9 | version.h 10 | FILES 11 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | /* version.h - version define for http_load */ 2 | 3 | #ifndef _VERSION_H_ 4 | #define _VERSION_H_ 5 | 6 | #define VERSION "http_load 12mar2006" 7 | 8 | #endif /* _VERSION_H_ */ 9 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | http_load - multiprocessing http test client 2 | version of 12mar2006 3 | 4 | http_load runs multiple http fetches in parallel, to test the 5 | throughput of a web server. However unlike most such test clients, 6 | it runs in a single process, so it doesn't bog down the client 7 | machine. It can be configured to do https fetches as well. 8 | 9 | See the manual entry for more details. 10 | 11 | Files in this distribution: 12 | 13 | README this 14 | Makefile guess 15 | http_load.c source file 16 | http_load.1 manual entry 17 | timers.c timers package 18 | timers.h headers for timers package 19 | make_test_files simple script to create a set of test files 20 | 21 | To build: If you're on a SysV-like machine (which includes old Linux systems 22 | but not new Linux systems), edit the Makefile and uncomment the SYSV_LIBS 23 | line. If you're doing SSL, uncomment those lines too. Otherwise, just do 24 | a make. 25 | 26 | Feedback is welcome - send bug reports, enhancements, checks, money 27 | orders, etc. to the addresses below. 28 | 29 | Jef Poskanzer jef@mail.acme.com http://www.acme.com/jef/ 30 | -------------------------------------------------------------------------------- /make_test_files: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # make_test_files - create a set of files for use with http_load 4 | # 5 | # This creates a specified number of files that are either a kilobyte 6 | # or a megabyte in length. The files are named kNNN and mNNN. 7 | 8 | if [ $# -ne 2 ] ; then 9 | echo "usage: $0 #kfiles #mfiles" >&2 10 | exit 1 11 | fi 12 | 13 | kfiles="$1" 14 | mfiles="$2" 15 | 16 | tmp=mtf.$$ 17 | ktmp=ktmp.$$ 18 | mtmp=mtmp.$$ 19 | rm -f $tmp $ktmp $mtmp 20 | 21 | if [ "$kfiles" -gt 0 ] ; then 22 | echo "123456789012345678901234567890123456789012345678901234567890123" > $ktmp 23 | cat $ktmp $ktmp $ktmp $ktmp > $tmp 24 | cat $tmp $tmp $tmp $tmp > $ktmp 25 | i=1 26 | while [ $i -le "$kfiles" ] ; do 27 | cp $ktmp "k$i" 28 | i=`expr "$i" + 1` 29 | done 30 | fi 31 | 32 | if [ "$mfiles" -gt 0 ] ; then 33 | echo "123456789012345678901234567890123456789012345678901234567890123" > $mtmp 34 | cat $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp > $tmp 35 | cat $tmp $tmp $tmp $tmp $tmp $tmp $tmp $tmp > $mtmp 36 | cat $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp $mtmp > $tmp 37 | cat $tmp $tmp $tmp $tmp $tmp $tmp $tmp $tmp > $mtmp 38 | cat $mtmp $mtmp > $tmp 39 | cat $tmp $tmp > $mtmp 40 | i=1 41 | while [ $i -le "$mfiles" ] ; do 42 | cp $mtmp "m$i" 43 | i=`expr "$i" + 1` 44 | done 45 | fi 46 | 47 | rm -f $tmp $ktmp $mtmp 48 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for http_load 2 | 3 | # CONFIGURE: If you are using a SystemV-based operating system, such as 4 | # Solaris, you will need to uncomment this definition. 5 | #SYSV_LIBS = -lnsl -lsocket -lresolv 6 | 7 | # CONFIGURE: If you want to compile in support for https, uncomment these 8 | # definitions. You will need to have already built OpenSSL, available at 9 | # http://www.openssl.org/ Make sure the SSL_TREE definition points to the 10 | # tree with your OpenSSL installation - depending on how you installed it, 11 | # it may be in /usr/local instead of /usr/local/ssl. 12 | #SSL_TREE = /usr/local/ssl 13 | #SSL_DEFS = -DUSE_SSL 14 | #SSL_INC = -I$(SSL_TREE)/include 15 | #SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto 16 | 17 | 18 | BINDIR = /usr/local/bin 19 | MANDIR = /usr/local/man/man1 20 | CC = gcc -Wall 21 | CFLAGS = -O $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC) 22 | #CFLAGS = -g $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC) 23 | LDFLAGS = -s $(SSL_LIBS) $(SYSV_LIBS) 24 | #LDFLAGS = -g $(SSL_LIBS) $(SYSV_LIBS) 25 | 26 | all: http_load 27 | 28 | http_load: http_load.o timers.o 29 | $(CC) $(CFLAGS) http_load.o timers.o $(LDFLAGS) -o http_load 30 | 31 | http_load.o: http_load.c timers.h port.h 32 | $(CC) $(CFLAGS) -c http_load.c 33 | 34 | timers.o: timers.c timers.h 35 | $(CC) $(CFLAGS) -c timers.c 36 | 37 | install: all 38 | rm -f $(BINDIR)/http_load 39 | cp http_load $(BINDIR) 40 | rm -f $(MANDIR)/http_load.1 41 | cp http_load.1 $(MANDIR) 42 | 43 | clean: 44 | rm -f http_load *.o core core.* *.core 45 | 46 | tar: 47 | @name=`sed -n -e '/define VERSION /!d' -e 's,.*http_load ,http_load-,' -e 's,",,p' version.h` ; \ 48 | rm -rf $$name ; \ 49 | mkdir $$name ; \ 50 | tar cf - `cat FILES` | ( cd $$name ; tar xfBp - ) ; \ 51 | chmod 644 $$name/Makefile ; \ 52 | tar cf $$name.tar $$name ; \ 53 | rm -rf $$name ; \ 54 | gzip $$name.tar 55 | -------------------------------------------------------------------------------- /port.h: -------------------------------------------------------------------------------- 1 | /* port.h - portability defines */ 2 | 3 | #if defined(__FreeBSD__) 4 | # define OS_FreeBSD 5 | # define ARCH "FreeBSD" 6 | #elif defined(__OpenBSD__) 7 | # define OS_OpenBSD 8 | # define ARCH "OpenBSD" 9 | #elif defined(__NetBSD__) 10 | # define OS_NetBSD 11 | # define ARCH "NetBSD" 12 | #elif defined(linux) 13 | # define OS_Linux 14 | # define ARCH "Linux" 15 | #elif defined(sun) 16 | # define OS_Solaris 17 | # define ARCH "Solaris" 18 | #elif defined(__osf__) 19 | # define OS_DigitalUnix 20 | # define ARCH "DigitalUnix" 21 | #elif defined(__svr4__) 22 | # define OS_SysV 23 | # define ARCH "SysV" 24 | #else 25 | # define OS_UNKNOWN 26 | # define ARCH "UNKNOWN" 27 | #endif 28 | 29 | #ifdef OS_FreeBSD 30 | # include 31 | # define HAVE_DAEMON 32 | # define HAVE_SETSID 33 | # define HAVE_SETLOGIN 34 | # define HAVE_WAITPID 35 | # define HAVE_HSTRERROR 36 | # define HAVE_TM_GMTOFF 37 | # define HAVE_SENDFILE 38 | # define HAVE_SCANDIR 39 | # define HAVE_INT64T 40 | # define HAVE_SRANDOMDEV 41 | # ifdef SO_ACCEPTFILTER 42 | # define HAVE_ACCEPT_FILTERS 43 | # if ( __FreeBSD_version >= 411000 ) 44 | # define ACCEPT_FILTER_NAME "httpready" 45 | # else 46 | # define ACCEPT_FILTER_NAME "dataready" 47 | # endif 48 | # endif /* SO_ACCEPTFILTER */ 49 | #endif /* OS_FreeBSD */ 50 | 51 | #ifdef OS_OpenBSD 52 | # define HAVE_DAEMON 53 | # define HAVE_SETSID 54 | # define HAVE_SETLOGIN 55 | # define HAVE_WAITPID 56 | # define HAVE_HSTRERROR 57 | # define HAVE_TM_GMTOFF 58 | # define HAVE_SCANDIR 59 | # define HAVE_INT64T 60 | #endif /* OS_OpenBSD */ 61 | 62 | #ifdef OS_NetBSD 63 | # define HAVE_DAEMON 64 | # define HAVE_SETSID 65 | # define HAVE_SETLOGIN 66 | # define HAVE_WAITPID 67 | # define HAVE_HSTRERROR 68 | # define HAVE_TM_GMTOFF 69 | # define HAVE_SCANDIR 70 | # define HAVE_INT64T 71 | #endif /* OS_NetBSD */ 72 | 73 | #ifdef OS_Linux 74 | # define HAVE_DAEMON 75 | # define HAVE_SETSID 76 | # define HAVE_WAITPID 77 | # define HAVE_TM_GMTOFF 78 | # define HAVE_SENDFILE 79 | # define HAVE_LINUX_SENDFILE 80 | # define HAVE_SCANDIR 81 | # define HAVE_INT64T 82 | #endif /* OS_Linux */ 83 | 84 | #ifdef OS_Solaris 85 | # define HAVE_SETSID 86 | # define HAVE_WAITPID 87 | # define HAVE_MEMORY_H 88 | # define HAVE_SIGSET 89 | # define HAVE_INT64T 90 | #endif /* OS_Solaris */ 91 | 92 | #ifdef OS_DigitalUnix 93 | # define HAVE_SETSID 94 | # define HAVE_SETLOGIN 95 | # define HAVE_WAITPID 96 | # define HAVE_SCANDIR 97 | # define HAVE_TM_GMTOFF 98 | # define NO_SNPRINTF 99 | /* # define HAVE_INT64T */ /* Digital Unix 4.0d doesn't have int64_t */ 100 | #endif /* OS_DigitalUnix */ 101 | 102 | #ifdef OS_SysV 103 | # define HAVE_SETSID 104 | # define HAVE_WAITPID 105 | # define HAVE_MEMORY_H 106 | # define HAVE_SIGSET 107 | #endif /* OS_Solaris */ 108 | --------------------------------------------------------------------------------