httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: mod_status.c patch
Date Sat, 04 May 1996 11:18:17 GMT
Jim Jagielski wrote:
> 
> Here's my take on Chuck's patches for mod_status.c. It assumes that the
> http_main.c "patch" isn't included and that we still have just child and
> slot counters available. If there's desire, I'll add in per-connection
> counters as well.
> 
> Also folded in is the sprintf() return value workaround... Basically we
> just call sprintf() and then use strlen() instead of relying on sprintf
> to return the # of chars copied.

I'd still like to fix sprintf by the os_sprintf method rather than this one.
Why? Well, its neater and on those OSes where sprintf works properly, more
efficient.

I'm happy enough to make the change after these patches are committed, though.

Cheers,

Ben.

> 
> Comments and feedback welcomed!
> 
> 
> Index: apache/src/mod_status.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_status.c,v
> retrieving revision 1.14
> diff -c -r1.14 mod_status.c
> *** mod_status.c	1996/04/17 00:30:58	1.14
> --- mod_status.c	1996/05/03 21:17:40
> ***************
> *** 61,66 ****
> --- 61,67 ----
>    * GET /.status?refresh - Returns page with 1 second refresh
>    * GET /.status?refresh=6 - Returns page with refresh every 6 seconds
>    * GET /.status?auto - Returns page with data for automatic parsing
> +  * GET /.status?notable - Returns page with no table niceties
>    *
>    * Mark Cox, mark@ukweb.com, November 1995
>    *
> ***************
> *** 72,77 ****
> --- 73,80 ----
>    * 25.3.96  Show uptime better [Mark/Ben Laurie]
>    * 29.3.96  Better HTML and explanation [Mark/Rob Hartill suggested]
>    * 09.4.96  Added message for non-STATUS compiled version
> +  * 18.4.96  Added per child and per slot counters [Jim Jagielski]
> +  * 01.5.96  Table format, cleanup, even more spiffy data [Chuck Murcko]
>    */
>   
>   #include "httpd.h"
> ***************
> *** 83,103 ****
>   #include <time.h>
>   #include "scoreboard.h"
>   
>   module status_module;
>   
>   /* Format the number of bytes nicely */
>   
> ! void format_byte_out(request_rec *r,unsigned long bytes) {
>       char ss[20];
>   
> !     if (bytes<5196)
>           sprintf(ss,"%dB",(int)bytes);
> !     else if (bytes<524288)
> ! 	sprintf(ss,"%.1fkB",(float)bytes/1024);
> !     else if (bytes<536870912)
> ! 	sprintf(ss,"%.1fMB",(float)bytes/1048576);
>       else
> ! 	sprintf(ss,"%.1fGB",(float)bytes/1073741824);
>       rputs(ss,r);
>   }
>   
> --- 86,117 ----
>   #include <time.h>
>   #include "scoreboard.h"
>   
> + #define STAT_OPT_REFRESH	0
> + #define STAT_OPT_NOTABLE	1
> + #define STAT_OPT_AUTO		2
> + 
> + #define STATUS_MAXLINE		50
> + 
> + #define KBYTE			1024
> + #define	MBYTE			1048576L
> + #define	GBYTE			1073741824L
> + 
>   module status_module;
>   
>   /* Format the number of bytes nicely */
>   
> ! void format_byte_out(request_rec *r,unsigned long bytes)
> ! {
>       char ss[20];
>   
> !     if (bytes < (5 * KBYTE))
>           sprintf(ss,"%dB",(int)bytes);
> !     else if (bytes < (MBYTE / 2))
> ! 	sprintf(ss,"%.1fkB",(float)bytes/KBYTE);
> !     else if (bytes < (GBYTE / 2))
> ! 	sprintf(ss,"%.1fMB",(float)bytes/MBYTE);
>       else
> ! 	sprintf(ss,"%.1fGB",(float)bytes/GBYTE);
>       rputs(ss,r);
>   }
>   
> ***************
> *** 115,128 ****
>       days=tsecs/24;
>       s=buf;
>       *s='\0';
> !     if(days)
> !       s+=sprintf(s," %ld day%s",days,days==1?"":"s");
> !     if(hrs)
> !       s+=sprintf(s," %ld hour%s",hrs,hrs==1?"":"s");
> !     if(mins)
> !       s+=sprintf(s," %ld minute%s",mins,mins==1?"":"s");
> !     if(secs)
> !       s+=sprintf(s," %ld second%s",secs,secs==1?"":"s");
>       rputs(buf,r);
>   }
>   
> --- 129,150 ----
>       days=tsecs/24;
>       s=buf;
>       *s='\0';
> !     if(days) {
> !       sprintf(s," %ld day%s",days,days==1?"":"s");
> !       s+=strlen(s);
> !     }
> !     if(hrs) {
> !       sprintf(s," %ld hour%s",hrs,hrs==1?"":"s");
> !       s+=strlen(s);
> !     }
> !     if(mins) {
> !       sprintf(s," %ld minute%s",mins,mins==1?"":"s");
> !       s+=strlen(s);
> !     }
> !     if(secs) {
> !       sprintf(s," %ld second%s",secs,secs==1?"":"s");
> !       s+=strlen(s);
> !     }
>       rputs(buf,r);
>   }
>   
> ***************
> *** 130,135 ****
> --- 152,165 ----
>   
>   int status_handler (request_rec *r)
>   {
> +     char *options[] =        /* see #defines above */
> +     {
> +         "refresh",
> +         "notable",
> +         "auto",
> +         NULL
> +     };
> +     char *loc;
>       time_t nowtime=time(NULL);
>       time_t up_time;
>       int i,res;
> ***************
> *** 141,152 ****
>       unsigned long my_lres,my_bytes;
>       unsigned long bcount=0;
>       float tick=sysconf(_SC_CLK_TCK);
> ! #endif
>       int short_report=0;
>       server_rec *server = r->server;
>       short_score score_record;
>       char status[]="???????";
>       char buffer[200];
>       clock_t tu,ts,tcu,tcs;
>   
>       tu=ts=tcu=tcs=0;
> --- 171,184 ----
>       unsigned long my_lres,my_bytes;
>       unsigned long bcount=0;
>       float tick=sysconf(_SC_CLK_TCK);
> ! #endif /* STATUS */
>       int short_report=0;
> +     int no_table_report=0;
>       server_rec *server = r->server;
>       short_score score_record;
>       char status[]="???????";
>       char buffer[200];
> +     char stat_buffer[HARD_SERVER_MAX];
>       clock_t tu,ts,tcu,tcs;
>   
>       tu=ts=tcu=tcs=0;
> ***************
> *** 160,273 ****
>       if (r->method_number != M_GET) return NOT_IMPLEMENTED;
>       r->content_type = "text/html";
>   
> !     if (r->args) {
> !         if (!strncmp(r->args,"refresh",7))
> ! 	  if(r->args[7] == '=')
> ! 	    table_set(r->headers_out,"Refresh",r->args+8);
> ! 	  else
> ! 	    table_set(r->headers_out,"Refresh","1");
> !         else if (!strncmp(r->args,"auto",4)) {
> ! 	  r->content_type = "text/plain";
> ! 	  short_report=1;
> ! 	}
>       }
>       soft_timeout ("send status info", r);
>       send_http_header(r);
>   
>       if (r->header_only) 
>   	return 0;
>   
> -     up_time=nowtime-restart_time;
> - 
> -     if (!short_report) {
> -         rputs("<html><head><title>Apache Status</title></head><body>",r);
> -         rputs("<h1>Apache Server Status</h1>\n\n",r);
> - 	rvputs(r,"Hostname: ",server->server_hostname,"<br>",NULL);
> - 	rvputs(r,"Current Time: ",asctime(localtime(&nowtime)),"<br>",NULL);
> - 	rvputs(r,"Restart Time: ",asctime(localtime(&restart_time)),"<br>",
> - 	       NULL);
> - 	rputs("Server up for: ",r);
> - 	show_time(r,up_time);
> - 	rputs("<p>",r);
> -     }
> - 
>       sync_scoreboard_image();
> !     rputs("Scoreboard: ",r);
> !     if(!short_report)
> ! 	rputs("<PRE>",r);
> !     for (i = 0; i<HARD_SERVER_MAX; ++i) {
>           score_record = get_scoreboard_info(i);
>           res = score_record.status;
> ! 	rputc(status[res],r);
>           if (res == SERVER_READY)
>   	    ready++;
>           else if (res == SERVER_BUSY_READ || res==SERVER_BUSY_WRITE || 
>   		 res == SERVER_STARTING)
>   	    busy++;
> - 	if(!short_report && i%25 == 24)
> - 	    rputs("\r\n",r);
> -     }
> -     if(!short_report) {
> - 	rputs("</PRE>",r);
> - 	rputs("Key: ",r);
> - 	rputs("\"<code>_</code>\" Waiting for Connection, ",r);
> - 	rputs("\"<code>S</code>\" Starting up, ",r);
> - 	rputs("\"<code>R</code>\" Reading Request, ",r);
> - 	rputs("\"<code>W</code>\" Sending Reply<p>",r);
> -     }
> -     if (short_report)
> -         sprintf(buffer,"\nBusyServers: %d\nIdleServers: %d\n",busy,ready);
> -     else 
> -         sprintf(buffer,"\n%d requests currently being processed,\n %d idle servers\n",busy,ready);
> -     rputs(buffer,r);
> - 
>   #if defined(STATUS)
> -     if (!short_report)
> -       rputs("<hr><h2>Server Details</h2>",r);
> -     for (i = 0; i<HARD_SERVER_MAX; ++i) {
> -         score_record=get_scoreboard_info(i);
>           lres = score_record.access_count;
> -         my_lres = score_record.my_access_count;
>   	bytes= score_record.bytes_served;
> ! 	my_bytes= score_record.my_bytes_served;
> !         if (lres!=0 || (score_record.status != SERVER_READY && score_record.status
!= SERVER_DEAD)) {
> ! 	    if (!short_report) {
> ! 	        sprintf(buffer,"<b>Server %d</b> (%d): %lu|%lu [",
> ! 		 i,(int)score_record.pid,my_lres,lres);
> ! 		rputs(buffer,r);
> ! 
> ! 		switch (score_record.status) {
> ! 		case SERVER_READY:
> ! 		    rputs("Ready",r);
> ! 		    break;
> ! 		case SERVER_STARTING:
> ! 		    rputs("Starting",r);
> ! 		    break;
> ! 		case SERVER_BUSY_READ:
> ! 		    rputs("<b>Read</b>",r);
> ! 		    break;
> ! 		case SERVER_BUSY_WRITE:
> ! 		    rputs("<b>Write</b>",r);
> ! 		    break;
> ! 		case SERVER_DEAD:
> ! 		    rputs("Dead",r);
> ! 		    break;
> ! 		}
> ! 		sprintf(buffer,"] u%g s%g cu%g cs%g %s (",
> ! 			score_record.times.tms_utime/tick,
> ! 			score_record.times.tms_stime/tick,
> ! 			score_record.times.tms_cutime/tick,
> ! 			score_record.times.tms_cstime/tick,
> ! 			asctime(localtime(&score_record.last_used)));
> ! 		rputs(buffer,r);
> ! 		format_byte_out(r,my_bytes);
> ! 		rputs("|",r);
> ! 		format_byte_out(r,bytes);
> ! 		rputs(")",r);
> ! 		sprintf(buffer," <i>%s {%s}</i><br>", score_record.client,
> ! 			score_record.request);
> ! 		rputs(buffer,r);
> ! 	    }
>   	    tu+=score_record.times.tms_utime;
>   	    ts+=score_record.times.tms_stime;
>   	    tcu+=score_record.times.tms_cutime;
> --- 192,247 ----
>       if (r->method_number != M_GET) return NOT_IMPLEMENTED;
>       r->content_type = "text/html";
>   
> !     if (r->args)
> !     {
> !         i = 0;
> !         while (options[i] != NULL)
> !         {
> !             if ((loc = strstr(r->args,options[i])) != NULL)
> !                 switch (i)
> !                 {
> !                   case STAT_OPT_REFRESH:
> !                       if(*(loc + strlen(options[i])) == '=')
> !                           table_set(r->headers_out,"Refresh",
> ! 				loc+strlen(options[i])+1);
> !                       else
> !                           table_set(r->headers_out,"Refresh","1");
> !                       break;
> !                   case STAT_OPT_NOTABLE:
> !                       no_table_report = 1;
> !                       break;
> !                   case STAT_OPT_AUTO:
> !                       r->content_type = "text/plain";
> !                       short_report=1;
> !                       break;
> !                 }
> !             i++;
> !         }
>       }
> + 
>       soft_timeout ("send status info", r);
>       send_http_header(r);
>   
>       if (r->header_only) 
>   	return 0;
>   
>       sync_scoreboard_image();
> !     for (i = 0; i<HARD_SERVER_MAX; ++i)
> !     {
>           score_record = get_scoreboard_info(i);
>           res = score_record.status;
> ! 	stat_buffer[i] = status[res];
>           if (res == SERVER_READY)
>   	    ready++;
>           else if (res == SERVER_BUSY_READ || res==SERVER_BUSY_WRITE || 
>   		 res == SERVER_STARTING)
>   	    busy++;
>   #if defined(STATUS)
>           lres = score_record.access_count;
>   	bytes= score_record.bytes_served;
> !         if (lres!=0 || (score_record.status != SERVER_READY
> ! 	  && score_record.status != SERVER_DEAD))
> ! 	{
>   	    tu+=score_record.times.tms_utime;
>   	    ts+=score_record.times.tms_stime;
>   	    tcu+=score_record.times.tms_cutime;
> ***************
> *** 275,353 ****
>               count+=lres;
>   	    bcount+=bytes;
>   	}
>       }
> !     if (short_report) {
>           sprintf(buffer,"Total Accesses: %lu\nTotal Bytes: %lu\n",count,bcount);
>   	rputs(buffer,r);
> !     } else {
> !         sprintf(buffer,"<p>Total accesses: %lu u%g s%g cu%g cs%g (",
> ! 		count,tu/tick,ts/tick,tcu/tick,tcs/tick);
> ! 	rputs(buffer,r);
> ! 	format_byte_out(r,bcount);
> ! 	rputs(")",r);
> !     }
> !     if (!short_report) {
> !         rputs("<hr><h2>Averages</h2>",r);
> ! 	if (up_time>0) {
> ! 	    sprintf(buffer,"%.3g request per second<br>\n",
> ! 		    (float)count/(float)up_time);
> ! 	    rputs(buffer,r);
> ! 	}
> ! 	if (up_time>0) {
> ! 	    format_byte_out(r,(float)bcount/(float)up_time);
> ! 	    rputs(" per second<br>\n",r);
> ! 	}
> ! 	if (count>0)  {
> ! 	    format_byte_out(r,(float)bcount/(float)count);
> ! 	    rputs(" per request<br>\n",r);
> ! 	}
>   	if(ts || tu || tcu || tcs)
> ! 	    {
> ! 	    sprintf(buffer,"%.3g%% CPU load<br>\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
>   	    rputs(buffer,r);
> ! 	    }
> !     } else {
>   	sprintf(buffer,"Uptime: %ld\n",(long)(up_time));
>   	rputs(buffer,r);
> ! 	if (up_time>0) { 
>   	    sprintf(buffer,"ReqPerSec: %g\n",
>   		    (float)count/(float)up_time);
>   	    rputs(buffer,r);
>   	}
> ! 	if (up_time>0) {
>   	    sprintf(buffer,"BytesPerSec: %g\n",
>   		(float)bcount/(float)up_time);
>   	    rputs(buffer,r);
>   	}
> ! 	if (count>0) {
>   	    sprintf(buffer,"BytesPerReq: %g\n",
>   		(float)bcount/(float)count);
>   	    rputs(buffer,r);
>   	}
>   	if(ts || tu || tcu || tcs)
> ! 	    {
> ! 	    sprintf(buffer,"CPULoad: %g\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
>   	    rputs(buffer,r);
>   	    }
>       }
>   #else
>       rputs("<hr>To obtain a full report with current status information ",r);
>       rputs("you need to recompile Apache adding the <code>-DSTATUS</code>
",r);
>       rputs("directive on the <code>CFLAGS</code> line in the ",r);
>       rputs("<code>Configuration</code> file.",r);
> ! #endif
>       if (!short_report)
>           rputs("</body></html>",r);
>       return 0;
>   }
>   
> ! handler_rec status_handlers[] = {
>   { STATUS_MAGIC_TYPE, status_handler },
>   { "server-status", status_handler },
>   { NULL }
>   };
>   
> ! module status_module = {
>      STANDARD_MODULE_STUFF,
>      NULL,			/* initializer */
>      NULL,			/* dir config creater */
> --- 249,516 ----
>               count+=lres;
>   	    bcount+=bytes;
>   	}
> + #endif /* STATUS */
>       }
> ! 
> !     up_time=nowtime-restart_time;
> ! 
> !     if (!short_report)
> !     {
> !         rputs("<html><head><title>Apache Status</title></head><body>",r);
> !         rputs("<h1>Apache Server Status</h1>\n\n",r);
> ! 	rvputs(r,"Hostname: ",server->server_hostname,"<br>",NULL);
> ! 	rvputs(r,"Current Time: ",asctime(localtime(&nowtime)),"<br>",NULL);
> ! 	rvputs(r,"Restart Time: ",asctime(localtime(&restart_time)),"<br>",
> ! 	       NULL);
> ! 	rputs("Server up for: ",r);
> ! 	show_time(r,up_time);
> ! 	rputs("<br>",r);
> !     }
> ! 
> ! #if defined(STATUS)
> !     if (short_report)
> !     {
>           sprintf(buffer,"Total Accesses: %lu\nTotal Bytes: %lu\n",count,bcount);
>   	rputs(buffer,r);
> ! 
>   	if(ts || tu || tcu || tcs)
> ! 	{
> ! 	    sprintf(buffer,"CPULoad: %g\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
>   	    rputs(buffer,r);
> ! 	}
> ! 
>   	sprintf(buffer,"Uptime: %ld\n",(long)(up_time));
>   	rputs(buffer,r);
> ! 	if (up_time>0)
> ! 	{ 
>   	    sprintf(buffer,"ReqPerSec: %g\n",
>   		    (float)count/(float)up_time);
>   	    rputs(buffer,r);
>   	}
> ! 
> ! 	if (up_time>0)
> ! 	{
>   	    sprintf(buffer,"BytesPerSec: %g\n",
>   		(float)bcount/(float)up_time);
>   	    rputs(buffer,r);
>   	}
> ! 
> ! 	if (count>0)
> ! 	{
>   	    sprintf(buffer,"BytesPerReq: %g\n",
>   		(float)bcount/(float)count);
>   	    rputs(buffer,r);
>   	}
> +     } else /* !short_report */
> +     {
> +         sprintf(buffer,"Total accesses: %lu - Total Traffic: ", count);
> + 	rputs(buffer,r);
> + 	format_byte_out(r,bcount);
> + 	rputs("<br>",r);
> +         sprintf(buffer,"CPU Usage: u%g s%g cu%g cs%g",
> + 		tu/tick,ts/tick,tcu/tick,tcs/tick);
> + 	rputs(buffer,r);
> + 
>   	if(ts || tu || tcu || tcs)
> ! 	{
> ! 	    sprintf(buffer," - %.3g%% CPU load\n",
> ! 		(tu+ts+tcu+tcs)/tick/up_time*100.);
>   	    rputs(buffer,r);
> + 	}
> + 
> + 	rputs("<br>",r);
> + 
> + 	if (up_time>0)
> + 	{
> + 	    sprintf(buffer,"%.3g requests/sec - \n",
> + 		    (float)count/(float)up_time);
> + 	    rputs(buffer,r);
> + 	}
> + 
> + 	if (up_time>0)
> + 	{
> + 	    format_byte_out(r,(float)bcount/(float)up_time);
> + 	    rputs("/second - ",r);
> + 	}
> + 
> + 	if (count>0)
> + 	{
> + 	    format_byte_out(r,(float)bcount/(float)count);
> + 	    rputs("/request\n",r);
> + 	}
> + 
> + 	rputs("<p>",r);
> +     } /* short_report */
> + #endif /* STATUS */
> + 
> +     /* send the scoreboard 'table' out */
> + 
> +     rputs("Scoreboard: ",r);
> + 
> +     if(!short_report)
> + 	rputs("<PRE>",r);
> +     else
> +         rputs("\r\n",r);
> + 
> +     for (i = 0; i<HARD_SERVER_MAX; ++i)
> +     {
> + 	rputc(stat_buffer[i], r);
> + 	if(i%STATUS_MAXLINE == (STATUS_MAXLINE - 1))
> + 	    rputs("\r\n",r);
> +     }
> + 
> +     if(!short_report)
> +     {
> + 	rputs("</PRE>",r);
> + 	rputs("Key: ",r);
> + 	rputs("\"<code>_</code>\" Waiting for Connection, ",r);
> + 	rputs("\"<code>S</code>\" Starting up, ",r);
> + 	rputs("\"<code>R</code>\" Reading Request, ",r);
> + 	rputs("\"<code>W</code>\" Sending Reply<p>",r);
> +     }
> + 
> +     if (short_report)
> +         sprintf(buffer,"\nBusyServers: %d\nIdleServers: %d\n",busy,ready);
> +     else 
> +         sprintf(buffer,"\n%d requests currently being processed,\n %d idle servers\n",busy,ready);
> +     rputs(buffer,r);
> + 
> + #if defined(STATUS)
> +     if (!short_report)
> +       if(no_table_report)
> +         rputs("<p><hr><h2>Server Details</h2>",r);
> +       else
> +         rputs("<p><table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU<th>SS
\
> +           <th>B1<th>B2<th>Host<th>Request</tr>",r);
> + 
> + 
> +     for (i = 0; i<HARD_SERVER_MAX; ++i)
> +     {
> +         score_record=get_scoreboard_info(i);
> +         lres = score_record.access_count;
> +         my_lres = score_record.my_access_count;
> + 	bytes= score_record.bytes_served;
> + 	my_bytes = score_record.my_bytes_served;
> +         if (lres!=0 || (score_record.status != SERVER_READY
> + 		&& score_record.status != SERVER_DEAD))
> + 	{
> + 	    if (!short_report)
> + 	    {
> + 		if (no_table_report)
> + 		{
> + 	            sprintf(buffer,"<b>Server %d</b> (%d): %lu|%lu [",
> + 		     i,(int)score_record.pid,my_lres,lres);
> + 		    rputs(buffer,r);
> + 
> + 		    switch (score_record.status)
> + 		    {
> + 		        case SERVER_READY:
> + 		            rputs("Ready",r);
> + 		            break;
> + 		        case SERVER_STARTING:
> + 		            rputs("Starting",r);
> + 		            break;
> + 		        case SERVER_BUSY_READ:
> + 		            rputs("<b>Read</b>",r);
> + 		            break;
> + 		        case SERVER_BUSY_WRITE:
> + 		            rputs("<b>Write</b>",r);
> + 		            break;
> + 		        case SERVER_DEAD:
> + 		            rputs("Dead",r);
> + 		            break;
> + 		    }
> + 		    sprintf(buffer,"] u%g s%g cu%g cs%g %s (",
> + 			    score_record.times.tms_utime/tick,
> + 			    score_record.times.tms_stime/tick,
> + 			    score_record.times.tms_cutime/tick,
> + 			    score_record.times.tms_cstime/tick,
> + 			    asctime(localtime(&score_record.last_used)));
> + 		    rputs(buffer,r);
> + 		    format_byte_out(r,my_bytes);
> + 		    rputs("|",r);
> + 		    format_byte_out(r,bytes);
> + 		    rputs(")",r);
> + 		    sprintf(buffer," <i>%s {%s}</i><br>", score_record.client,
> + 			    score_record.request);
> + 		    rputs(buffer,r);
> + 		}
> + 		else
> + 		{
> + 	            sprintf(buffer,"<tr><td><b>%d</b><td>%d<td>%lu/%lu",
> + 		     i,(int)score_record.pid,my_lres,lres);
> + 		    rputs(buffer,r);
> + 
> + 		    switch (score_record.status)
> + 		    {
> + 		        case SERVER_READY:
> + 		            rputs("<td>_",r);
> + 		            break;
> + 		        case SERVER_STARTING:
> + 		            rputs("<td><b>S</b>",r);
> + 		            break;
> + 		        case SERVER_BUSY_READ:
> + 		            rputs("<td><b>R</b>",r);
> + 		            break;
> + 		        case SERVER_BUSY_WRITE:
> + 		            rputs("<td><b>W</b>",r);
> + 		            break;
> + 		        case SERVER_DEAD:
> + 		            rputs("<td>.",r);
> + 		            break;
> + 		    }
> + 		    sprintf(buffer,"<td>%.2f<td>%.0f",
> + 			    (score_record.times.tms_utime +
> + 			    score_record.times.tms_stime +
> + 			    score_record.times.tms_cutime +
> + 			    score_record.times.tms_cstime)/tick,
> + 			    difftime(nowtime, score_record.last_used));
> + 		    rputs(buffer,r);
> + 		    sprintf(buffer,"<td>%-1.1f<td>%-2.2f",(float)my_bytes/KBYTE,
> + 			(float)bytes/MBYTE);
> + 		    rputs(buffer,r);
> + 		    sprintf(buffer,"<td>%s<td>%s</tr>", score_record.client,
> + 			    score_record.request);
> + 		    rputs(buffer,r);
> + 		}
>   	    }
> + 	}
> +     }
> +     if (!(short_report || no_table_report))
> +     {
> + 	rputs("</table> \
> + 	<ul> \
> + 	  <li>SRV = \"Server number\" \
> + 	  <li>PID = \"OS process ID\" \
> + 	  <li>Acc = \"Number of accesses this child / number of accesses \
> + 	      total by slot\" \
> + 	  <li>M = \"Mode of operation\" \
> + 	  <li>CPU = \"CPU usage, number of seconds\" \
> + 	  <li>SS = \"Seconds since beginning of most recent request\" \
> + 	  <li>B1 = \"Kilobytes transferred this child\" \
> + 	  <li>B2 = \"Total megabytes transferred this slot\" \
> + 	</UL>",r);
>       }
>   #else
>       rputs("<hr>To obtain a full report with current status information ",r);
>       rputs("you need to recompile Apache adding the <code>-DSTATUS</code>
",r);
>       rputs("directive on the <code>CFLAGS</code> line in the ",r);
>       rputs("<code>Configuration</code> file.",r);
> ! #endif /* STATUS */
>       if (!short_report)
>           rputs("</body></html>",r);
>       return 0;
>   }
>   
> ! handler_rec status_handlers[] =
> ! {
>   { STATUS_MAGIC_TYPE, status_handler },
>   { "server-status", status_handler },
>   { NULL }
>   };
>   
> ! module status_module =
> ! {
>      STANDARD_MODULE_STUFF,
>      NULL,			/* initializer */
>      NULL,			/* dir config creater */
> -- 
> Jim Jagielski  << jim@jaguNET.com >>   |      "That's a Smith & Wesson,
>   **  jaguNET Access Services  **      |       and you've had your six" 
>       Email: info@jaguNET.com          |             - James Bond
> ++    http://www.jaguNET.com/         +++      Voice/Fax: 410-931-3157       ++

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message