You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2001/05/07 18:24:19 UTC
cvs commit: httpd-2.0/include scoreboard.h
trawick 01/05/07 09:24:18
Modified: server scoreboard.c
modules/generators mod_status.c
include scoreboard.h
Log:
minor scoreboard/status improvements:
. get the SS field in extended status output formatted correctly
(seconds since beginning of request shouldn't be a huge
negative number :) )
. use APR_OS_PID_T_FMT and pid_t where appropriate in mod_status
to avoid casting, some of which may have been broken on some
architectures
Revision Changes Path
1.21 +1 -0 httpd-2.0/server/scoreboard.c
Index: scoreboard.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- scoreboard.c 2001/03/09 20:30:34 1.20
+++ scoreboard.c 2001/05/07 16:24:03 1.21
@@ -286,6 +286,7 @@
}
if (ap_extended_status) {
+ ss->last_used = apr_time_now();
if (status == SERVER_READY || status == SERVER_DEAD) {
/*
* Reset individual counters
1.36 +16 -13 httpd-2.0/modules/generators/mod_status.c
Index: mod_status.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mod_status.c 2001/05/07 15:49:42 1.35
+++ mod_status.c 2001/05/07 16:24:09 1.36
@@ -254,7 +254,7 @@
short_score score_record;
parent_score ps_record;
char stat_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT];
- int pid_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT];
+ pid_t pid_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT];
clock_t tu, ts, tcu, tcs;
server_rec *vhost;
@@ -321,7 +321,7 @@
ps_record = ap_scoreboard_image->parent[i];
res = score_record.status;
stat_buffer[indx] = status_flags[res];
- pid_buffer[indx] = (int) ps_record.pid;
+ pid_buffer[indx] = ps_record.pid;
if (res == SERVER_READY)
ready++;
else if (res != SERVER_DEAD)
@@ -348,7 +348,7 @@
}
/* up_time in seconds */
- up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/1000000);
+ up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/APR_USEC_PER_SEC);
if (!short_report) {
ap_rputs(DOCTYPE_HTML_3_2
@@ -479,8 +479,9 @@
int indx = (i * HARD_THREAD_LIMIT) + j;
if (stat_buffer[indx] != '.') {
- ap_rprintf(r, " %d in state: %c ", pid_buffer[i],
- stat_buffer[indx]);
+ ap_rprintf(r, " %" APR_OS_PROC_T_FMT
+ " in state: %c ", pid_buffer[i],
+ stat_buffer[indx]);
if (++k >= 3) {
ap_rputs("\n", r);
k = 0;
@@ -556,9 +557,10 @@
my_lres, lres);
else
ap_rprintf(r,
- "<b>Server %d-%d</b> (%d): %d|%lu|%lu [",
+ "<b>Server %d-%d</b> (%" APR_OS_PROC_T_FMT
+ "): %d|%lu|%lu [",
i, (int) ps_record.generation,
- (int) ps_record.pid,
+ ps_record.pid,
(int) conn_lres, my_lres, lres);
switch (score_record.status) {
@@ -598,13 +600,13 @@
ap_rprintf(r, "]\n %.0f %ld (",
#else
- ap_rprintf(r, "] u%g s%g cu%g cs%g\n %.0f %ld (",
+ ap_rprintf(r, "] u%g s%g cu%g cs%g\n %ld %ld (",
score_record.times.tms_utime / tick,
score_record.times.tms_stime / tick,
score_record.times.tms_cutime / tick,
score_record.times.tms_cstime / tick,
#endif
- difftime(nowtime, score_record.last_used),
+ (long)((nowtime - score_record.last_used) / APR_USEC_PER_SEC),
(long) req_time);
format_byte_out(r, conn_bytes);
ap_rputs("|", r);
@@ -626,9 +628,10 @@
(int) conn_lres, my_lres, lres);
else
ap_rprintf(r,
- "<tr><td><b>%d-%d</b><td>%d<td>%d/%lu/%lu",
+ "<tr><td><b>%d-%d</b><td>%" APR_OS_PROC_T_FMT
+ "<td>%d/%lu/%lu",
i, (int) ps_record.generation,
- (int) ps_record.pid, (int) conn_lres,
+ ps_record.pid, (int) conn_lres,
my_lres, lres);
switch (score_record.status) {
@@ -667,13 +670,13 @@
/* Allow for OS/2 not having CPU stats */
ap_rprintf(r, "\n<td>%.0f<td>%ld",
#else
- ap_rprintf(r, "\n<td>%.2f<td>%.0f<td>%ld",
+ ap_rprintf(r, "\n<td>%.2f<td>%ld<td>%ld",
(score_record.times.tms_utime +
score_record.times.tms_stime +
score_record.times.tms_cutime +
score_record.times.tms_cstime) / tick,
#endif
- difftime(nowtime, score_record.last_used),
+ (long)((nowtime - score_record.last_used) / APR_USEC_PER_SEC),
(long) req_time);
ap_rprintf(r, "<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
(float) conn_bytes / KBYTE, (float) my_bytes / MBYTE,
1.19 +1 -16 httpd-2.0/include/scoreboard.h
Index: scoreboard.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/scoreboard.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- scoreboard.h 2001/05/07 15:49:35 1.18
+++ scoreboard.h 2001/05/07 16:24:14 1.19
@@ -97,21 +97,6 @@
#define SERVER_IDLE_KILL 11 /* Server is cleaning up idle children. */
#define SERVER_NUM_STATUS 12 /* number of status settings */
-/* A "virtual time" is simply a counter that indicates that a child is
- * making progress. The parent checks up on each child, and when they have
- * made progress it resets the last_rtime element. But when the child hasn't
- * made progress in a time that's roughly timeout_len seconds long, it is
- * sent a SIGALRM.
- *
- * vtime is an optimization that is used only when the scoreboard is in
- * shared memory (it's not easy/feasible to do it in a scoreboard file).
- * The essential observation is that timeouts rarely occur, the vast majority
- * of hits finish before any timeout happens. So it really sucks to have to
- * ask the operating system to set up and destroy alarms many times during
- * a request.
- */
-typedef unsigned vtime_t;
-
/* Type used for generation indicies. Startup and every restart cause a
* new generation of children to be spawned. Children within the same
* generation share the same configuration information -- pointers to stuff
@@ -166,7 +151,7 @@
#ifdef HAVE_TIMES
struct tms times;
#endif
- time_t last_used;
+ apr_time_t last_used;
char client[32]; /* Keep 'em small... */
char request[64]; /* We just want an idea... */
server_rec *vhostrec; /* What virtual host is being accessed? */
Re: cvs commit: httpd-2.0/include scoreboard.h
Posted by Jeff Trawick <tr...@bellsouth.net>.
Cliff Woolley <cl...@yahoo.com> writes:
> > . get the SS field in extended status output formatted correctly
> > (seconds since beginning of request shouldn't be a huge
> > negative number :) )
>
> Ahh, thanks, Jeff. Fixing that has been on my todo list for like a month
> now and I just never got back to it. There was a STATUS note about this
> which I just removed.
:) I didn't realize it was in the STATUS file. I started on this
a while back and ran into the OPTIMIZE_TIMEOUTS issue (i.e., "I'm 90%
sure I need to delete this cruft but it'd be nice to find somebody who
understands it's [ir]relevance to 2.0.").
--
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
Re: cvs commit: httpd-2.0/include scoreboard.h
Posted by Cliff Woolley <cl...@yahoo.com>.
On 7 May 2001 trawick@apache.org wrote:
> trawick 01/05/07 09:24:18
>
> Modified: server scoreboard.c
> modules/generators mod_status.c
> include scoreboard.h
> Log:
> minor scoreboard/status improvements:
> . get the SS field in extended status output formatted correctly
> (seconds since beginning of request shouldn't be a huge
> negative number :) )
Ahh, thanks, Jeff. Fixing that has been on my todo list for like a month
now and I just never got back to it. There was a STATUS note about this
which I just removed.
--Cliff
--------------------------------------------------------------
Cliff Woolley
cliffwoolley@yahoo.com
Charlottesville, VA