From: Roy T. Fielding Date: Thu, 26 Aug 1999 17:34:28 +0000 (+0000) Subject: Changes to mod_status so that the two new states for threads are recognized X-Git-Tag: PRE_APR_CHANGES~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4eb9d8508c42658365a2dd66c0deeda3dfe2c41;p=apache Changes to mod_status so that the two new states for threads are recognized and reported properly. Submitted by: Ryan Bloom git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83794 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 88fc087090..53d7770913 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -230,7 +230,7 @@ static int status_handler(request_rec *r) char *loc; time_t nowtime = time(NULL); time_t up_time; - int i, res; + int i, j, res; int ready = 0; int busy = 0; unsigned long count = 0; @@ -249,9 +249,9 @@ static int status_handler(request_rec *r) #endif int short_report = 0; int no_table_report = 0; - short_score score_record; + thread_score score_record; parent_score ps_record; - char stat_buffer[HARD_SERVER_LIMIT]; + char stat_buffer[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; int pid_buffer[HARD_SERVER_LIMIT]; clock_t tu, ts, tcu, tcs; server_rec *vhost; @@ -307,14 +307,16 @@ static int status_handler(request_rec *r) ap_sync_scoreboard_image(); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; + for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + score_record = ap_scoreboard_image->servers[i][j]; ps_record = ap_scoreboard_image->parent[i]; res = score_record.status; - stat_buffer[i] = status_flags[res]; + stat_buffer[i][j] = status_flags[res]; pid_buffer[i] = (int) ps_record.pid; if (res == SERVER_READY) ready++; - else if (res != SERVER_DEAD) + else if (res != SERVER_DEAD && res != SERVER_ACCEPTING + && res != SERVER_QUEUEING && res != SERVER_STARTING) busy++; if (ap_extended_status) { lres = score_record.access_count; @@ -335,10 +337,11 @@ static int status_handler(request_rec *r) } } } + } up_time = nowtime - ap_restart_time; - ap_hard_timeout("send status info", r); + /* ap_hard_timeout("send status info", r); */ if (!short_report) { ap_rputs(DOCTYPE_HTML_3_2 @@ -422,7 +425,7 @@ static int status_handler(request_rec *r) } /* ap_extended_status */ if (!short_report) - ap_rprintf(r, "\n%d requests currently being processed, %d idle servers\n" + ap_rprintf(r, "\n%d connections currently being processed, %d idle servers\n" ,busy, ready); else ap_rprintf(r, "BusyServers: %d\nIdleServers: %d\n", busy, ready); @@ -435,10 +438,13 @@ static int status_handler(request_rec *r) ap_rputs("Scoreboard: ", r); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - ap_rputc(stat_buffer[i], r); - if ((i % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report) + for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + ap_rputc(stat_buffer[i][j], r); + if ((((i * HARD_THREAD_LIMIT) + j) % STATUS_MAXLINE == + (STATUS_MAXLINE - 1)) && !short_report) ap_rputs("\n", r); } + } if (short_report) ap_rputs("\n", r); @@ -453,23 +459,27 @@ static int status_handler(request_rec *r) ap_rputs("\"D\" DNS Lookup,
\n", r); ap_rputs("\"L\" Logging, \n", r); ap_rputs("\"G\" Gracefully finishing, \n", r); + ap_rputs("\"A\" Accepting on port,
\n", r); + ap_rputs("\"Q\" Queueing connection, \n", r); ap_rputs("\".\" Open slot with no current process

\n", r); ap_rputs("

\n", r); if (!ap_extended_status) { - int j = 0; + int k = 0; ap_rputs("PID Key:
\n", r); ap_rputs("

\n", r);
 	    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
-		if (stat_buffer[i] != '.') {
-		    ap_rprintf(r, "   %d in state: %c ", pid_buffer[i],
-		     stat_buffer[i]);
-		    if (++j >= 3) {
+	    for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
+		if (stat_buffer[i][j] != '.') {
+		    ap_rprintf(r, "   %d,%d in state: %c ", pid_buffer[i], j,
+                        stat_buffer[i][j]);
+		    if (++k >= 3) {
 		    	ap_rputs("\n", r);
-			j = 0;
+			k = 0;
 		    } else
 		    	ap_rputs(",", r);
 		}
 	    }
+	    }
 	    ap_rputs("\n", r);
 	    ap_rputs("
\n", r); } @@ -482,14 +492,15 @@ static int status_handler(request_rec *r) else #ifdef NO_TIMES /* Allow for OS/2 not having CPU stats */ - ap_rputs("

\n\n\n\n", r); + ap_rputs("

\n\n

SrvPIDAccM\nSSReqConnChildSlotClientVHostRequest
\n\n", r); #else - ap_rputs("

\n\n

SrvPIDTIDAccM\nSSReqConnChildSlotClientVHostRequest
\n\n", r); + ap_rputs("

\n\n

SrvPIDAccMCPU\nSSReqConnChildSlotClientVHostRequest
\n\n", r); #endif } for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; + for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + score_record = ap_scoreboard_image->servers[i][j]; ps_record = ap_scoreboard_image->parent[i]; vhost = score_record.vhostrec; if (ps_record.generation != ap_my_generation) { @@ -536,9 +547,10 @@ static int status_handler(request_rec *r) my_lres, lres); else ap_rprintf(r, - "Server %d-%d (%d): %d|%lu|%lu [", + "Server %d-%d (pid: %d, tid: %d): %d|%lu|%lu [", i, (int) ps_record.generation, (int) ps_record.pid, + (int) j, (int) conn_lres, my_lres, lres); switch (score_record.status) { @@ -604,14 +616,14 @@ static int status_handler(request_rec *r) else { /* !no_table_report */ if (score_record.status == SERVER_DEAD) ap_rprintf(r, - "
SrvPIDTIDAccMCPU\nSSReqConnChildSlotClientVHostRequest
%d-%d-%d/%lu/%lu", + "
%d-%d--%d/%lu/%lu", i, (int) ps_record.generation, (int) conn_lres, my_lres, lres); else ap_rprintf(r, - "
%d-%d%d%d/%lu/%lu", + "
%d-%d%d%d%d/%lu/%lu", i, (int) ps_record.generation, - (int) ps_record.pid, (int) conn_lres, + (int) ps_record.pid, (int) j, (int) conn_lres, my_lres, lres); switch (score_record.status) { @@ -642,6 +654,12 @@ static int status_handler(request_rec *r) case SERVER_GRACEFUL: ap_rputs("G", r); break; + case SERVER_ACCEPTING: + ap_rputs("A", r); + break; + case SERVER_QUEUEING: + ap_rputs("Q", r); + break; default: ap_rputs("?", r); break; @@ -678,6 +696,7 @@ static int status_handler(request_rec *r) } /* !short_report */ } /* if () */ } /* for () */ + } if (!(short_report || no_table_report)) { #ifdef NO_TIMES @@ -686,6 +705,7 @@ static int status_handler(request_rec *r) \n \
SrvChild Server number - generation\n \
PIDOS process ID\n \ +
TIDOS thread ID\n \
AccNumber of accesses this connection / this child / this slot\n \
MMode of operation\n \
SSSeconds since beginning of most recent request\n \ @@ -700,6 +720,7 @@ static int status_handler(request_rec *r) \n \
SrvChild Server number - generation\n \
PIDOS process ID\n \ +
TIDOS thread ID\n \
AccNumber of accesses this connection / this child / this slot\n \
MMode of operation\n \
CPUCPU usage, number of seconds\n \ @@ -724,13 +745,17 @@ static int status_handler(request_rec *r) ap_rputs("\n", r); } - ap_kill_timeout(r); + /* ap_kill_timeout(r); */ return 0; } static void status_init(server_rec *s, pool *p) { + int i; + for (i = 0; i < SERVER_NUM_STATUS; i++) + status_flags[i] = '?'; + status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */ status_flags[SERVER_READY] = '_'; /* any particular order in scoreboard.h */ status_flags[SERVER_STARTING] = 'S'; @@ -740,6 +765,8 @@ static void status_init(server_rec *s, pool *p) status_flags[SERVER_BUSY_LOG] = 'L'; status_flags[SERVER_BUSY_DNS] = 'D'; status_flags[SERVER_GRACEFUL] = 'G'; + status_flags[SERVER_ACCEPTING] = 'A'; + status_flags[SERVER_QUEUEING] = 'Q'; } static const handler_rec status_handlers[] =