You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jean-Jacques Clar <JJ...@novell.com> on 2003/03/03 20:02:41 UTC
Run-Time clock in the MPM
Having a time structure in the mpm keeping updated sec and uSEC
field could help performance for the web server.
It could replace most calls to apr_time_now() and apr_time_sec()
at run-time:
NetWare has its main thread resuming every 1000000 uSEC (1 sec)
to do the idle server maintenance.
The following code keep a local timeval structure, which could
return current time without having to call apr_time_now() every
request.
Yes, only the tv_sec field is updated between call to gettimeofday().
Who cares about the uSEC precision anyway, apache is a web server,
not a scientific clock application.
With the following function, calls to apr_time_now() in apache could
then be replaced with call to ap_time_now().
Or maybe just redefining apr_time_now() to ap_time_now() and
apr_time_sec() to ap_time_sec() will work for us.
I am thinking of using a set of functions like the following ones in
the
NetWare mpm:
The synchonize_usec_clock() function is called every second by the main
thread when it resumes to do the idle maintenance.
It synchronizes the time fields every 5 seconds using the
gettimeofday() function.
Anyone sees problems with using a background thread to maintain
current time structure?
--- boc ---
static apr_int32_t mpm_clock_initialized;
static apr_time_t now;
struct timeval tv;
static void synchonize_usec_clock( void )
{
static apr_int32_t counter;
if (mpm_clock_initialized) {
if(++counter > 4) {
gettimeofday(&tv, NULL);
now = tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec;
counter = 0;
}
else {
now += SCOREBOARD_MAINTENANCE_INTERVAL;
tv.tv_sec++;
}
}
else {
gettimeofday(&tv, NULL);
now = tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec;
mpm_clock_initialized = 1;
}
}
AP_DECLARE(apr_time_t) ap_time_now(void)
{
if (mpm_clock_initialized)
return now;
else
return apr_time_now();
}
AP_DECLARE(apr_time_t) ap_time_sec(apr_time_t time)
{
if (mpm_clock_initialized)
return tv.tv_sec;
else
return apr_time_sec(time);
}
--- eoc ---
Thank you,
Jean-Jacques
grep problem
Posted by Jie Gao <J....@isu.usyd.edu.au>.
Hi All,
Solaris 5.9 Generic_112233-04, httpd 2.0.44
-------------------------------------------
make produces errors like the following:
/bin/bash /opt/local/src/httpd-2.0.44/srclib/apr/libtool --silent --mode=link gcc -g -O2 -Wall
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthreads -DSOLARIS2=9
-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER
-I/opt/local/src/httpd-2.0.44/srclib/apr/include -I/usr/local/src/httpd-2.0.44/srclib/apr/include
-I/opt/local/src/httpd-2.0.44/srclib/apr-util/include
-I/usr/local/src/httpd-2.0.44/srclib/apr-util/include
-I/opt/local/src/httpd-2.0.44/srclib/apr-util/xml/expat/lib -I. -I/usr/local/src/httpd-2.0.44/os/unix
-I/usr/local/src/httpd-2.0.44/server/mpm/prefork -I/usr/local/src/httpd-2.0.44/modules/http
-I/usr/local/src/httpd-2.0.44/modules/filters -I/usr/local/src/httpd-2.0.44/modules/proxy
-I/usr/local/src/httpd-2.0.44/include -I/usr/local/src/httpd-2.0.44/modules/dav/main -export-dynamic
-L/opt/local/src/httpd-2.0.44/srclib/apr-util/xml/expat/lib -o mod_rewrite.la -rpath
/usr/local/apache_2.0.44/modules -module -avoid-version mod_rewrite.lo
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
grep: illegal option -- e
Usage: grep -hblcnsviw pattern file . . .
grep: illegal option -- e
grep: illegal option -- L
grep: illegal option -- /
grep: illegal option -- o
grep: illegal option -- p
grep: illegal option -- t
grep: illegal option -- /
grep: illegal option -- o
grep: illegal option -- a
grep: illegal option -- /
grep: illegal option -- r
grep: illegal option -- /
grep: illegal option -- t
grep: illegal option -- t
grep: illegal option -- p
grep: illegal option -- d
grep: illegal option -- -
grep: illegal option -- 2
grep: illegal option -- .
grep: illegal option -- 0
grep: illegal option -- .
grep: illegal option -- 4
grep: illegal option -- 4
grep: illegal option -- /
grep: illegal option -- r
grep: illegal option -- /
grep: illegal option -- a
grep: illegal option -- p
grep: illegal option -- r
grep: illegal option -- -
grep: illegal option -- u
grep: illegal option -- t
grep: illegal option -- /
grep: illegal option -- x
grep: illegal option -- m
grep: illegal option -- /
grep: illegal option -- e
grep: illegal option -- x
grep: illegal option -- p
grep: illegal option -- a
grep: illegal option -- t
grep: illegal option -- /
Usage: grep -hblcnsviw pattern file . . .
gmake[4]: Leaving directory `/opt/local/src/httpd-2.0.44/modules/mappers'
Sincerely,
Jie