From: Martin Kraemer Date: Tue, 16 Jul 2002 09:28:40 +0000 (+0000) Subject: Fix the long-standing bug that "ab -t10" would loop for 10000 seconds X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5ed88a7b2057d7264c7ee549f0d7fc5d02e35d2;p=apache Fix the long-standing bug that "ab -t10" would loop for 10000 seconds instead of 10 as documented. Also fix an off-by-one-second error, which did not matter much (in comparison to the 1000x error ;-) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96073 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/ab.c b/support/ab.c index 3849d3c194..df19f00a25 100644 --- a/support/ab.c +++ b/support/ab.c @@ -278,7 +278,7 @@ int heartbeatres = 100; /* How often do we say we're alive */ int concurrency = 1; /* Number of multiple requests to make */ int percentile = 1; /* Show percentile served */ int confidence = 1; /* Show confidence estimator and warnings */ -int tlimit = 0; /* time limit in cs */ +int tlimit = 0; /* time limit in secs */ int keepalive = 0; /* try and do keepalive connections */ char servername[1024]; /* name that server reports */ char *hostname; /* host name from URL */ @@ -1639,8 +1639,9 @@ static void test(void) /* check for time limit expiry */ now = apr_time_now(); timed = (apr_int32_t)apr_time_sec(now - start); - if (tlimit && timed > (tlimit * 1000)) { + if (tlimit && timed >= tlimit) { requests = done; /* so stats are correct */ + break; /* no need to do another round */ } n = concurrency; @@ -1726,14 +1727,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.111 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.112 $> apache-2.0"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.111 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.112 $"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
\n"); printf("

\n

\n");