summaryrefslogtreecommitdiff
path: root/sapi/cgi
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2013-09-27 13:44:31 +0400
committerDmitry Stogov <dmitry@zend.com>2013-09-27 13:44:31 +0400
commit3eba8cf6739f987c111ea2276ada8d7caca1eb9b (patch)
treec2d7c55261a0423e49c7ea56e5f3dc5958346739 /sapi/cgi
parent9ef4e5d23d331227cbc3dfed04f9702b8012e1ef (diff)
parentf90483001236c863abe1070d05ee2214db5a0a97 (diff)
downloadphp-git-3eba8cf6739f987c111ea2276ada8d7caca1eb9b.tar.gz
Merge branch 'PHP-5.5'
* PHP-5.5: Added support for GNU Hurd. (Svante Signell) Conflicts: NEWS
Diffstat (limited to 'sapi/cgi')
-rw-r--r--sapi/cgi/cgi_main.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 221b002175..59194118b5 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -154,6 +154,7 @@ static const opt_struct OPTIONS[] = {
{'?', 0, "usage"},/* help alias (both '?' and 'usage') */
{'v', 0, "version"},
{'z', 1, "zend-extension"},
+ {'W', 1, "warmup"},
{'T', 1, "timing"},
{'-', 0, NULL} /* end of args */
};
@@ -1754,6 +1755,7 @@ int main(int argc, char *argv[])
int fcgi_fd = 0;
fcgi_request *request = NULL;
int repeats = 1;
+ int warmup_repeats = 0;
int benchmark = 0;
#if HAVE_GETTIMEOFDAY
struct timeval start, end;
@@ -2103,6 +2105,9 @@ consult the installation file that came with this distribution, or visit \n\
time(&start);
#endif
break;
+ case 'W':
+ warmup_repeats = atoi(php_optarg);
+ break;
case 'h':
case '?':
if (request) {
@@ -2516,12 +2521,24 @@ fastcgi_request_done:
if (!fastcgi) {
if (benchmark) {
- repeats--;
- if (repeats > 0) {
- script_file = NULL;
- php_optind = orig_optind;
- php_optarg = orig_optarg;
+ if (warmup_repeats) {
+ warmup_repeats--;
+ if (!warmup_repeats) {
+#ifdef HAVE_GETTIMEOFDAY
+ gettimeofday(&start, NULL);
+#else
+ time(&start);
+#endif
+ }
continue;
+ } else {
+ repeats--;
+ if (repeats > 0) {
+ script_file = NULL;
+ php_optind = orig_optind;
+ php_optarg = orig_optarg;
+ continue;
+ }
}
}
break;