From: Jim Jagielski Date: Fri, 16 Nov 2012 13:07:48 +0000 (+0000) Subject: Fold in a missing optimization... X-Git-Tag: 2.5.0-alpha~6112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e46152c143558b690bd1adab7ec639d224f23f50;p=apache Fold in a missing optimization... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1410328 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/eventopt/eventopt.c b/server/mpm/eventopt/eventopt.c index a36414ad8f..fbf189d532 100644 --- a/server/mpm/eventopt/eventopt.c +++ b/server/mpm/eventopt/eventopt.c @@ -57,7 +57,7 @@ #include "apr_atomic.h" #define APR_WANT_STRFUNC #include "apr_want.h" -#include "apr_version.h" +#include "apr_env.h" #if APR_HAVE_UNISTD_H #include @@ -145,10 +145,6 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) -#if !APR_VERSION_AT_LEAST(1,4,0) -#define apr_time_from_msec(x) (x * 1000) -#endif - #ifndef MAX_SECS_TO_LINGER #define MAX_SECS_TO_LINGER 30 #endif @@ -2145,6 +2141,27 @@ static void join_start_thread(apr_thread_t * start_thread_id) } } +static void force_set_tz(apr_pool_t *p) { + /* If the TZ variable is unset, many operationg systems, + * such as Linux, will at runtime read from /etc/localtime + * and call fstat on it. + * + * By forcing the time zone to UTC if it is unset, we gain + * about 2% in raw requests/second (since we format log files + * in the local time, if present) + * + * For more info, see: + * + */ + char *v = NULL; + apr_status_t rv; + + rv = apr_env_get(&v, "TZ", p); + if (v == NULL || rv == APR_ENOENT) { + apr_env_set("TZ", "UTC+0", p); + } +} + static void child_main(int child_num_arg) { apr_thread_t **threads; @@ -3186,6 +3203,7 @@ static void event_hooks(apr_pool_t * p) */ static const char *const aszSucc[] = { "core.c", NULL }; one_process = 0; + force_set_tz(p); ap_hook_open_logs(event_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST); /* we need to set the MPM state before other pre-config hooks use MPM query