httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject mod_status.c update... Lets make it pretty
Date Sat, 04 May 1996 00:33:43 GMT
Here's my latest take on the mod_status.c update. I've included the
desired per_connection counters as well, which required some changes
to scoreboard.h and http_main.c. It's now printed in mod_status.

The data (per connection/per child/per slot) is correctly calculated
and it's all available, however the table-output is ugly and needs
works. Better people than I will need to do that :)

In any case, it's a starting point.

PS: It's a big patch.

Index: apache/src/http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.24
diff -c -r1.24 http_main.c
*** http_main.c	1996/04/18 11:16:36	1.24
--- http_main.c	1996/05/04 00:26:48
***************
*** 672,677 ****
--- 672,679 ----
  	 */
  	new_score_rec.my_access_count = 0L;
  	new_score_rec.my_bytes_served = 0L;
+ 	new_score_rec.conn_count = (unsigned short)0;
+ 	new_score_rec.conn_bytes = (unsigned short)0;
      }
      if (r) {
  	int slot_size;
***************
*** 713,719 ****
  }
  
  #if defined(STATUS)
! void increment_counts (int child_num, request_rec *r)
  {
      long int bs=0;
      short_score new_score_rec=scoreboard_image[child_num];
--- 715,721 ----
  }
  
  #if defined(STATUS)
! void increment_counts (int child_num, request_rec *r, int flag)
  {
      long int bs=0;
      short_score new_score_rec=scoreboard_image[child_num];
***************
*** 721,730 ****
--- 723,738 ----
      if (r->sent_bodyct)
          bgetopt(r->connection->client, BO_BYTECT, &bs);
  
+     if (flag) {
+ 	new_score_rec.conn_count = (unsigned short)0;
+ 	new_score_rec.conn_bytes = (unsigned short)0;
+     }
      new_score_rec.access_count ++;
      new_score_rec.my_access_count ++;
+     new_score_rec.conn_count ++;
      new_score_rec.bytes_served += (unsigned long)bs;
      new_score_rec.my_bytes_served += (unsigned long)bs;
+     new_score_rec.conn_bytes += (unsigned short)bs;
  
      times(&new_score_rec.times);
  
***************
*** 1176,1182 ****
  	if (r) process_request (r); /* else premature EOF --- ignore */
  
  #if defined(STATUS)
!         if (r) increment_counts(child_num,r);
  #endif
  	while (r && current_conn->keepalive) {
  	  bflush(conn_io);
--- 1184,1190 ----
  	if (r) process_request (r); /* else premature EOF --- ignore */
  
  #if defined(STATUS)
!         if (r) increment_counts(child_num,r,1);
  #endif
  	while (r && current_conn->keepalive) {
  	  bflush(conn_io);
***************
*** 1187,1193 ****
  	  if (r) process_request (r);
  
  #if defined(STATUS)
! 	  if (r) increment_counts(child_num,r);
  #endif
  	}
  #if 0	
--- 1195,1201 ----
  	  if (r) process_request (r);
  
  #if defined(STATUS)
! 	  if (r) increment_counts(child_num,r,0);
  #endif
  	}
  #if 0	
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/04 00:26:50
***************
*** 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/Jim J.]
   */
  
  #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;
***************
*** 139,152 ****
      unsigned long count=0;
      unsigned long lres,bytes;
      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;
--- 169,185 ----
      unsigned long count=0;
      unsigned long lres,bytes;
      unsigned long my_lres,my_bytes;
+     unsigned short conn_lres,conn_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;
--- 193,248 ----
      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 */
--- 250,523 ----
              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>B0<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;
+ 	conn_lres = score_record.conn_count;
+ 	bytes= score_record.bytes_served;
+ 	my_bytes = score_record.my_bytes_served;
+ 	conn_bytes = score_record.conn_bytes;
+         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): %d|%lu|%lu [",
+ 		     i,(int)score_record.pid,(int)conn_lres,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,(unsigned long)conn_bytes);
+ 		    rputs("|",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>%d/%lu/%lu",
+ 		     i,(int)score_record.pid,(int)conn_lres,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<td>%-2.2f",
+ 			(float)conn_bytes/KBYTE, (float)my_bytes/MBYTE,
+ 			(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 connection / this child / \
+ 	      this slot\" \
+ 	  <li>M = \"Mode of operation\" \
+ 	  <li>CPU = \"CPU usage, number of seconds\" \
+ 	  <li>SS = \"Seconds since beginning of most recent request\" \
+ 	  <li>B0 = \"Kilobytes transferred this connection\" \
+ 	  <li>B1 = \"Megabytes 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 */
Index: apache/src/scoreboard.h
===================================================================
RCS file: /export/home/cvs/apache/src/scoreboard.h,v
retrieving revision 1.8
diff -c -r1.8 scoreboard.h
*** scoreboard.h	1996/04/09 08:18:37	1.8
--- scoreboard.h	1996/05/04 00:26:51
***************
*** 77,82 ****
--- 77,84 ----
      unsigned long bytes_served;
      unsigned long my_access_count;
      unsigned long my_bytes_served;
+     unsigned short conn_count;
+     unsigned short conn_bytes;
      struct tms times;
      time_t last_used;
      char client[32];	/* Keep 'em small... */
-- 
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       ++

Mime
View raw message