diff options
author | Colm MacCarthaigh <colm@apache.org> | 2006-03-31 23:54:25 +0200 |
---|---|---|
committer | Colm MacCarthaigh <colm@apache.org> | 2006-03-31 23:54:25 +0200 |
commit | e804af2c37b4df48dd688b840b7226103c31f4ba (patch) | |
tree | 6f874f0d0e41c0ec04bcb18395d188ff01bcdd00 /support/ab.c | |
parent | * Sync with 2.2.x CHANGES file (diff) | |
download | apache2-e804af2c37b4df48dd688b840b7226103c31f4ba.tar.xz apache2-e804af2c37b4df48dd688b840b7226103c31f4ba.zip |
* Add siege-like behaviour to ApacheBench; output the results, as they have
accrued so far, when the user interrupts with ctrl-c. As the signal handler
is non-reentrant, we don't need volatiles, and the operations all look
signal-safe.
* Update the base version, since handling a signal differently is an external
API change of sorts.
* set the LastChangedRevision svn property, as ab.c has $Rev $ embedded, so
it really should be.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@390511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | support/ab.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/support/ab.c b/support/ab.c index a0d0aaa454..7c6f8b0e5c 100644 --- a/support/ab.c +++ b/support/ab.c @@ -80,6 +80,10 @@ ** Switched to the new abstract pollset API, allowing ab to ** take advantage of future apr_pollset_t scalability improvements. ** Contributed by Brian Pane, August 31, 2002 + ** + ** Version 2.3 + ** SIGINT now triggers output_results(). + ** Conributed by colm, March 30, 2006 **/ /* Note: this version string should start with \d+[\d\.]* and be a valid @@ -91,7 +95,7 @@ * ab - or to due to a change in the distribution it is compiled with * (such as an APR change in for example blocking). */ -#define AP_AB_BASEREVISION "2.0.40-dev" +#define AP_AB_BASEREVISION "2.3" /* * BUGS: @@ -719,7 +723,7 @@ static int compwait(struct data * a, struct data * b) return 0; } -static void output_results(void) +static void output_results(int sig) { apr_interval_time_t timetakenusec; float timetaken; @@ -970,6 +974,10 @@ static void output_results(void) } } + + if (sig) { + exit(1); + } } /* --------------------------------------------------------- */ @@ -1606,6 +1614,11 @@ static void test(void) /* ok - lets start */ start = apr_time_now(); +#ifdef SIGINT + /* Output the results if the user terminates the run early. */ + apr_signal(SIGINT, output_results); +#endif + /* initialise lots of requests */ for (i = 0; i < concurrency; i++) { con[i].socknum = i; @@ -1736,7 +1749,7 @@ static void test(void) if (use_html) output_html_results(); else - output_results(); + output_results(0); } /* ------------------------------------------------------- */ @@ -1745,14 +1758,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.146 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision$>"); printf("Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("<p>\n"); - printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.146 $"); + printf(" This is ApacheBench, Version %s <i><%s></i><br>\n", AP_AB_BASEREVISION, "$Revision$"); printf(" Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n"); printf(" Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/<br>\n"); printf("</p>\n<p>\n"); |