httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1410328 - /httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
Date Fri, 16 Nov 2012 13:07:49 GMT
Author: jim
Date: Fri Nov 16 13:07:48 2012
New Revision: 1410328

URL: http://svn.apache.org/viewvc?rev=1410328&view=rev
Log:
Fold in a missing optimization...

Modified:
    httpd/httpd/trunk/server/mpm/eventopt/eventopt.c

Modified: httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/eventopt/eventopt.c?rev=1410328&r1=1410327&r2=1410328&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/eventopt/eventopt.c (original)
+++ httpd/httpd/trunk/server/mpm/eventopt/eventopt.c Fri Nov 16 13:07:48 2012
@@ -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 <unistd.h>
@@ -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
     }
 }
 
+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:
+     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
+     */
+    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



Mime
View raw message