Created
August 2, 2010 15:21
-
-
Save lloyd/504803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur siege-2.69.orig/src/cfg.h siege-2.69/src/cfg.h | |
--- siege-2.69.orig/src/cfg.h 2009-06-02 00:00:24.000000000 -0600 | |
+++ siege-2.69/src/cfg.h 2009-06-02 00:13:27.000000000 -0600 | |
@@ -15,6 +15,7 @@ | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
+ | |
* You should have received a copy of the GNU General Public License | |
* along with this program; if not, write to the Free Software | |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
diff -ur siege-2.69.orig/src/client.c siege-2.69/src/client.c | |
--- siege-2.69.orig/src/client.c 2009-06-02 00:00:24.000000000 -0600 | |
+++ siege-2.69/src/client.c 2009-06-02 11:10:17.000000000 -0600 | |
@@ -312,6 +312,14 @@ | |
return FALSE; | |
} | |
+ /** | |
+ * a sleep we'll perform with the connection open, a simple | |
+ * approximation of limited client bandwidth. | |
+ */ | |
+ if(my.readDelay){ | |
+ pthread_sleep_np(my.readDelay); | |
+ } | |
+ | |
bytes = http_read(C); | |
if(!my.zero_ok && (bytes < 1)){ | |
diff -ur siege-2.69.orig/src/init.c siege-2.69/src/init.c | |
--- siege-2.69.orig/src/init.c 2009-06-02 00:00:24.000000000 -0600 | |
+++ siege-2.69/src/init.c 2009-06-02 00:07:33.000000000 -0600 | |
@@ -160,6 +160,8 @@ | |
printf( "repetitions: n/a\n" ); | |
printf( "socket timeout: %d\n", my.timeout ); | |
printf( "delay: %d sec%s\n", my.delay,my.delay>1?"s":"" ); | |
+ printf( "read delay: %d sec%s\n", | |
+ my.readDelay, my.readDelay>1?"s":"" ); | |
printf( "internet simulation: %s\n", my.internet?"true":"false" ); | |
printf( "benchmark mode: %s\n", my.bench?"true":"false" ); | |
printf( "failures until abort: %d\n", my.failures ); | |
@@ -323,6 +325,13 @@ | |
my.delay = 1; | |
} | |
} | |
+ else if(strmatch(option, "read-delay")){ | |
+ if(value != NULL){ | |
+ my.readDelay = atoi(value); | |
+ } else { | |
+ my.readDelay = 1; | |
+ } | |
+ } | |
else if(strmatch(option, "timeout")){ | |
if(value != NULL){ | |
my.timeout = atoi(value); | |
@@ -525,6 +534,7 @@ | |
#else | |
my.delay = 0; | |
#endif | |
+ my.readDelay = 0; | |
} | |
if( my.secs > 0 && (( my.reps > 0 ) && ( my.reps != MAXREPS ))){ | |
NOTIFY(ERROR, "CONFIG conflict: selected time and repetition based testing" ); | |
diff -ur siege-2.69.orig/src/main.c siege-2.69/src/main.c | |
--- siege-2.69.orig/src/main.c 2009-06-02 00:00:24.000000000 -0600 | |
+++ siege-2.69/src/main.c 2009-06-02 11:08:58.000000000 -0600 | |
@@ -69,6 +69,7 @@ | |
{ "reps", required_argument, NULL, 'r' }, | |
{ "time", required_argument, NULL, 't' }, | |
{ "delay", required_argument, NULL, 'd' }, | |
+ { "read-delay", required_argument, NULL, 'w' }, | |
{ "log", no_argument, NULL, 'l' }, | |
{ "file", required_argument, NULL, 'f' }, | |
{ "rc", required_argument, NULL, 'R' }, | |
@@ -144,6 +145,7 @@ | |
printf(" -l, --log LOG, logs the transaction to PREFIX/var/%s.log\n", program_name); | |
puts(" -m, --mark=\"text\" MARK, mark the log file with a string separator." ); | |
puts(" -d, --delay=NUM Time DELAY, random delay between 1 and num designed" ); | |
+ puts(" -w, --read-delay=NUM Time DELAY, after reading headers before reading body and closing connection" ); | |
puts(" to simulate human activity. Default value is 3" ); | |
puts(" -H, --header=\"text\" Add a header to request (can be many)" ); | |
puts(" -A, --user-agent=\"text\" Sets User-Agent in request" ); | |
@@ -165,7 +167,7 @@ | |
strcpy(my.rc, ""); | |
while( a > -1 ){ | |
- a = getopt_long(argc, argv, "VhvCDglibr:t:f:d:c:u:m:H:R:A:", long_options, (int*)0); | |
+ a = getopt_long(argc, argv, "VhvCDglibr:t:f:d:c:u:m:H:R:A:w:", long_options, (int*)0); | |
if(a == 'R'){ | |
strcpy(my.rc, optarg); | |
a = -1; | |
@@ -184,7 +186,7 @@ | |
{ | |
int c = 0; | |
int nargs; | |
- while((c = getopt_long( argc, argv, "VhvCDglibr:t:f:d:c:u:m:H:R:A:", | |
+ while((c = getopt_long( argc, argv, "VhvCDglibr:t:f:d:c:u:m:H:R:A:w:", | |
long_options, (int *)0)) != EOF){ | |
switch(c){ | |
case 'V': | |
@@ -215,6 +217,13 @@ | |
my.delay = 0; | |
} | |
break; | |
+ case 'w': | |
+ /* XXX range checking? use strtol? */ | |
+ my.readDelay = atoi(optarg); | |
+ if(my.readDelay < 0){ | |
+ my.readDelay = 0; | |
+ } | |
+ break; | |
case 'g': | |
my.get = TRUE; | |
break; | |
diff -ur siege-2.69.orig/src/setup.h siege-2.69/src/setup.h | |
--- siege-2.69.orig/src/setup.h 2009-06-02 00:00:24.000000000 -0600 | |
+++ siege-2.69/src/setup.h 2009-06-02 00:09:08.000000000 -0600 | |
@@ -156,6 +156,7 @@ | |
BOOLEAN config; /* boolean, prints the configuration */ | |
int cusers; /* default concurrent users value. */ | |
int delay; /* range for random time delay, see -d */ | |
+ int readDelay; /* range for random time delay, see -w */ | |
int timeout; /* socket connection timeout value, def:10 */ | |
BOOLEAN bench; /* signifies a benchmarking run, no delay */ | |
BOOLEAN internet; /* use random URL selection if TRUE */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment