From: Jeff Trawick Date: Fri, 15 Mar 2002 15:30:22 +0000 (+0000) Subject: speed up the short_report path... we were unnecessarily X-Git-Tag: CHANGES~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ae24550fc007d685c9f851de7d09dc40430f879;p=apache speed up the short_report path... we were unnecessarily walking the scoreboard Submitted by: Stas Bekman git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93955 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 13151f4d88..4098840dd2 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -530,22 +530,20 @@ static int status_handler(request_rec *r) } } - if (ap_extended_status) { - if (!short_report) { - if (no_table_report) - ap_rputs("

Server Details

\n\n", r); - else - ap_rputs("\n\n" - "" - "" + if (ap_extended_status && !short_report) { + if (no_table_report) + ap_rputs("

Server Details

\n\n", r); + else + ap_rputs("\n\n
SrvPIDAccM
" + "" + "" #ifdef HAVE_TIMES - "" + "" #endif - "" - "" - "" - "\n\n", r); - } + "" + "" + "" + "\n\n", r); for (i = 0; i < server_limit; ++i) { for (j = 0; j < thread_limit; ++j) { @@ -574,182 +572,180 @@ static int status_handler(request_rec *r) my_bytes = ws_record.my_bytes_served; conn_bytes = ws_record.conn_bytes; - if (!short_report) { - if (no_table_report) { - if (ws_record.status == SERVER_DEAD) - ap_rprintf(r, - "Server %d-%d (-): %d|%lu|%lu [", - i, (int)ps_record.generation, - (int)conn_lres, my_lres, lres); - else - ap_rprintf(r, - "Server %d-%d (%" - APR_OS_PROC_T_FMT "): %d|%lu|%lu [", - i, (int) ps_record.generation, - ps_record.pid, - (int)conn_lres, my_lres, lres); - - switch (ws_record.status) { - case SERVER_READY: - ap_rputs("Ready", r); - break; - case SERVER_STARTING: - ap_rputs("Starting", r); - break; - case SERVER_BUSY_READ: - ap_rputs("Read", r); - break; - case SERVER_BUSY_WRITE: - ap_rputs("Write", r); - break; - case SERVER_BUSY_KEEPALIVE: - ap_rputs("Keepalive", r); - break; - case SERVER_BUSY_LOG: - ap_rputs("Logging", r); - break; - case SERVER_BUSY_DNS: - ap_rputs("DNS lookup", r); - break; - case SERVER_CLOSING: - ap_rputs("Closing", r); - break; - case SERVER_DEAD: - ap_rputs("Dead", r); - break; - case SERVER_GRACEFUL: - ap_rputs("Graceful", r); - break; - case SERVER_IDLE_KILL: - ap_rputs("Dying", r); - break; - default: - ap_rputs("?STATE?", r); - break; - } - - ap_rprintf(r, "] " + if (no_table_report) { + if (ws_record.status == SERVER_DEAD) + ap_rprintf(r, + "Server %d-%d (-): %d|%lu|%lu [", + i, (int)ps_record.generation, + (int)conn_lres, my_lres, lres); + else + ap_rprintf(r, + "Server %d-%d (%" + APR_OS_PROC_T_FMT "): %d|%lu|%lu [", + i, (int) ps_record.generation, + ps_record.pid, + (int)conn_lres, my_lres, lres); + + switch (ws_record.status) { + case SERVER_READY: + ap_rputs("Ready", r); + break; + case SERVER_STARTING: + ap_rputs("Starting", r); + break; + case SERVER_BUSY_READ: + ap_rputs("Read", r); + break; + case SERVER_BUSY_WRITE: + ap_rputs("Write", r); + break; + case SERVER_BUSY_KEEPALIVE: + ap_rputs("Keepalive", r); + break; + case SERVER_BUSY_LOG: + ap_rputs("Logging", r); + break; + case SERVER_BUSY_DNS: + ap_rputs("DNS lookup", r); + break; + case SERVER_CLOSING: + ap_rputs("Closing", r); + break; + case SERVER_DEAD: + ap_rputs("Dead", r); + break; + case SERVER_GRACEFUL: + ap_rputs("Graceful", r); + break; + case SERVER_IDLE_KILL: + ap_rputs("Dying", r); + break; + default: + ap_rputs("?STATE?", r); + break; + } + + ap_rprintf(r, "] " #ifdef HAVE_TIMES - "u%g s%g cu%g cs%g" + "u%g s%g cu%g cs%g" #endif - "\n %ld %ld (", + "\n %ld %ld (", #ifdef HAVE_TIMES - ws_record.times.tms_utime / tick, - ws_record.times.tms_stime / tick, - ws_record.times.tms_cutime / tick, - ws_record.times.tms_cstime / tick, + ws_record.times.tms_utime / tick, + ws_record.times.tms_stime / tick, + ws_record.times.tms_cutime / tick, + ws_record.times.tms_cstime / tick, #endif - (long)((nowtime - ws_record.last_used) / - APR_USEC_PER_SEC), - (long) req_time); - - format_byte_out(r, conn_bytes); - ap_rputs("|", r); - format_byte_out(r, my_bytes); - ap_rputs("|", r); - format_byte_out(r, bytes); - ap_rputs(")\n", r); + (long)((nowtime - ws_record.last_used) / + APR_USEC_PER_SEC), + (long) req_time); + + format_byte_out(r, conn_bytes); + ap_rputs("|", r); + format_byte_out(r, my_bytes); + ap_rputs("|", r); + format_byte_out(r, bytes); + ap_rputs(")\n", r); + ap_rprintf(r, + " %s {%s}[%s]
\n\n", + ap_escape_html(r->pool, + ws_record.client), + ap_escape_html(r->pool, + ws_record.request), + ap_escape_html(r->pool, + ws_record.vhost)); + } + else { /* !no_table_report */ + if (ws_record.status == SERVER_DEAD) ap_rprintf(r, - " %s {%s}[%s]
\n\n", - ap_escape_html(r->pool, - ws_record.client), - ap_escape_html(r->pool, - ws_record.request), - ap_escape_html(r->pool, - ws_record.vhost)); - } - else { /* !no_table_report */ - if (ws_record.status == SERVER_DEAD) - ap_rprintf(r, - "" + "" #ifdef HAVE_TIMES - "" + "" #endif - "\n\n"); - else - ap_rprintf(r, - "\n\n", - ap_escape_html(r->pool, - ws_record.client), - ap_escape_html(r->pool, - ws_record.vhost), - ap_escape_html(r->pool, - ws_record.request)); - } /* no_table_report */ - } /* !short_report */ + (long)((nowtime - ws_record.last_used) / + APR_USEC_PER_SEC), + (long)req_time); + + ap_rprintf(r, "\n\n"); + else + ap_rprintf(r, + "\n\n", + ap_escape_html(r->pool, + ws_record.client), + ap_escape_html(r->pool, + ws_record.vhost), + ap_escape_html(r->pool, + ws_record.request)); + } /* no_table_report */ } /* for (j...) */ } /* for (i...) */ - if (!(short_report || no_table_report)) { + if (!no_table_report) { ap_rputs("
SrvPIDAccMCPU\nCPU\nSSReqConnChildSlotClientVHostRequest
SSReqConnChildSlotClientVHostRequest
%d-%d-%d/%lu/%lu", - i, (int)ps_record.generation, - (int)conn_lres, my_lres, lres); - else - ap_rprintf(r, - "
%d-%d%" - APR_OS_PROC_T_FMT - "%d/%lu/%lu", - i, (int)ps_record.generation, - ps_record.pid, (int)conn_lres, - my_lres, lres); - - switch (ws_record.status) { - case SERVER_READY: - ap_rputs("_", r); - break; - case SERVER_STARTING: - ap_rputs("S", r); - break; - case SERVER_BUSY_READ: - ap_rputs("R", r); - break; - case SERVER_BUSY_WRITE: - ap_rputs("W", r); - break; - case SERVER_BUSY_KEEPALIVE: - ap_rputs("K", r); - break; - case SERVER_BUSY_LOG: - ap_rputs("L", r); - break; - case SERVER_BUSY_DNS: - ap_rputs("D", r); - break; - case SERVER_CLOSING: - ap_rputs("C", r); - break; - case SERVER_DEAD: - ap_rputs(".", r); - break; - case SERVER_GRACEFUL: - ap_rputs("G", r); - break; - case SERVER_IDLE_KILL: - ap_rputs("I", r); - break; - default: - ap_rputs("?", r); - break; - } - + "
%d-%d-%d/%lu/%lu", + i, (int)ps_record.generation, + (int)conn_lres, my_lres, lres); + else ap_rprintf(r, - "\n
%d-%d%" + APR_OS_PROC_T_FMT + "%d/%lu/%lu", + i, (int)ps_record.generation, + ps_record.pid, (int)conn_lres, + my_lres, lres); + + switch (ws_record.status) { + case SERVER_READY: + ap_rputs("_", r); + break; + case SERVER_STARTING: + ap_rputs("S", r); + break; + case SERVER_BUSY_READ: + ap_rputs("R", r); + break; + case SERVER_BUSY_WRITE: + ap_rputs("W", r); + break; + case SERVER_BUSY_KEEPALIVE: + ap_rputs("K", r); + break; + case SERVER_BUSY_LOG: + ap_rputs("L", r); + break; + case SERVER_BUSY_DNS: + ap_rputs("D", r); + break; + case SERVER_CLOSING: + ap_rputs("C", r); + break; + case SERVER_DEAD: + ap_rputs(".", r); + break; + case SERVER_GRACEFUL: + ap_rputs("G", r); + break; + case SERVER_IDLE_KILL: + ap_rputs("I", r); + break; + default: + ap_rputs("?", r); + break; + } + + ap_rprintf(r, + "\n%.2f%.2f%ld%ld", + "%ld%ld", #ifdef HAVE_TIMES - (ws_record.times.tms_utime + - ws_record.times.tms_stime + - ws_record.times.tms_cutime + - ws_record.times.tms_cstime) / tick, + (ws_record.times.tms_utime + + ws_record.times.tms_stime + + ws_record.times.tms_cutime + + ws_record.times.tms_cstime) / tick, #endif - (long)((nowtime - ws_record.last_used) / - APR_USEC_PER_SEC), - (long)req_time); - - ap_rprintf(r, "%-1.1f%-2.2f%-2.2f\n", - (float)conn_bytes / KBYTE, (float) my_bytes / MBYTE, - (float)bytes / MBYTE); - - if (ws_record.status == SERVER_BUSY_READ) - ap_rprintf(r, - "??..reading..
%s%s%s
%-1.1f%-2.2f%-2.2f\n", + (float)conn_bytes / KBYTE, (float) my_bytes / MBYTE, + (float)bytes / MBYTE); + + if (ws_record.status == SERVER_BUSY_READ) + ap_rprintf(r, + "??..reading..
%s%s%s
\n \
\ \n \ @@ -769,7 +765,7 @@ static int status_handler(request_rec *r) \n \
SlotTotal megabytes transferred this slot
\n", r); } - } + } /* if (ap_extended_status && !short_report) */ else { if (!short_report) {