This is a multi-part message in MIME format.
--------------050405090002070103060308
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
A Solaris server with 4GB of RAM was giving negative values in the
"Total Mem" column of the backhand-handler page because it was using %d
instead of %u. While making fixes to that I started tweaking other parts
of the layout to be a little easier to read. Here's exactly what this
patch changes:
*) Center all column headings.
*) Change justification of some columns so they line up more logically.
*) Reduce the precision of the displayed "Load" and "CPU Idle" data to
match more closely the actual precision of the numbers. It's still a
magnitude more precise than uptime(1), that doesn't necessarily mean we
can't be more accurate internally.
*) Display memory amounts as megabytes rather than bytes.
*) Change the "Total Mem" and "Avail Mem" columns to display as unsigned
integers. Because of the previous change, there was little chance they
will ever show up as negative, but since the memory amounts really ARE
unsigned, it shouldn't hurt.
If you don't want all of these formatting changes, just change the '%d's
in the memory columns to '%u's and that will at least fix the
signed/unsigned problem.
--Mike Cramer
--------------050405090002070103060308
Content-Type: text/plain;
name="backhand-handler.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="backhand-handler.patch"
Index: mod_backhand/back_util.c
===================================================================
RCS file: /storage/cvs/jesus/mod_backhand/back_util.c,v
retrieving revision 1.16
diff -u -r1.16 back_util.c
--- mod_backhand/back_util.c 2001/10/23 20:25:17 1.16
+++ mod_backhand/back_util.c 2001/10/24 18:56:43
@@ -163,13 +163,13 @@
time_t now = time(NULL);
mypid = getpid();
ap_rputs("<TABLE CELLSPACING=0 CELLPADDING=4 BORDER=0 BGCOLOR=#ffffff>\
-<TR bgcolor=#9999ee><TD><B align=center>Entry</B></TD><TD><B>Hostname</B></TD>\
-<TD align=right><B>Age</B></TD><TD align=center><B>Address</B></TD>\
-<TD align=right><B>Total Mem</B></TD><TD align=left><B>Avail Mem</B></TD>\
+<TR bgcolor=#9999ee><TD><B align=center>Entry</B></TD><TD align=center><B>Hostname</B></TD>\
+<TD align=center><B>Age</B></TD><TD align=center><B>Address</B></TD>\
+<TD align=center><B>Total Mem</B></TD><TD align=center><B>Avail Mem</B></TD>\
<TD align=center><B># ready servers/<BR># total servers</B></TD>\
<TD align=center><B>~ms/req [#req]</B></TD>\
-<TD align=right><B>Arriba</B></TD><TD align=center><B># CPUs</B></TD>\
-<TD align=right><B>Load/HWM</B></TD><TD align=right><B>CPU Idle</B></TD></TR>\n",
+<TD align=center><B>Arriba</B></TD><TD align=center><B># CPUs</B></TD>\
+<TD align=center><B>Load/HWM</B></TD><TD align=center><B>CPU Idle</B></TD></TR>\n",
r);
for(i=0;i<MAXSERVERS;i++) {
tempport = ntohs(serverstats[i].contact.sin_port);
@@ -180,18 +180,23 @@
hostaddress[21] = '\0';
if(serverstats[i].contact.sin_addr.s_addr!=0)
ap_rprintf(r, "<TR bgcolor=%s><TD align=center>%d</TD><TD>%s</TD>\
-<TD align=right>%d</TD><TD align=center>%s</TD><TD align=right>%d</TD>\
-<TD align=left>%d</TD><TD align=center>%d/%d</TD><TD align=center>%d [%d]</TD>\
+<TD align=right>%d</TD><TD align=center>%s</TD><TD align=right>%u MB</TD>\
+<TD align=right>%u MB</TD><TD align=center>%d/%d</TD><TD align=center>%d [%d]</TD>\
<TD align=right>%d</TD>\
-<TD align=center>%d</TD><TD align=right>%f/%d</TD><TD align=right>%f</TD></TR>\n",
+<TD align=center>%d</TD><TD align=right>%0.3f/%d</TD><TD align=right>%0.3f</TD></TR>\n",
(!is_alive(i,SERVER_TIMEOUT,now))?"#ff4444":
(i%2)?"#aaaaaa":"#cccccc",
i, /* Entry */
serverstats[i].hostname, /* hostname */
(int)(time(NULL) - serverstats[i].mtime), /* Age */
hostaddress, /* aaa.bbb.ccc.ddd:port */
- serverstats[i].tmem, /* Total physical memory */
- serverstats[i].amem, /* Avilable memory */
+
+ /* Total physical memory in megabytes */
+ ((unsigned int)serverstats[i].tmem)/(1024*1024),
+
+ /* Avilable memory in megabytes */
+ ((unsigned int)serverstats[i].amem)/(1024*1024),
+
serverstats[i].aservers, /* # ready Apache procs */
serverstats[i].nservers, /* # of Apache procs */
serverstats[i].tatime, /* Ave ms / request */
--------------050405090002070103060308--
--------------050405090002070103060308
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
A Solaris server with 4GB of RAM was giving negative values in the
"Total Mem" column of the backhand-handler page because it was using %d
instead of %u. While making fixes to that I started tweaking other parts
of the layout to be a little easier to read. Here's exactly what this
patch changes:
*) Center all column headings.
*) Change justification of some columns so they line up more logically.
*) Reduce the precision of the displayed "Load" and "CPU Idle" data to
match more closely the actual precision of the numbers. It's still a
magnitude more precise than uptime(1), that doesn't necessarily mean we
can't be more accurate internally.
*) Display memory amounts as megabytes rather than bytes.
*) Change the "Total Mem" and "Avail Mem" columns to display as unsigned
integers. Because of the previous change, there was little chance they
will ever show up as negative, but since the memory amounts really ARE
unsigned, it shouldn't hurt.
If you don't want all of these formatting changes, just change the '%d's
in the memory columns to '%u's and that will at least fix the
signed/unsigned problem.
--Mike Cramer
--------------050405090002070103060308
Content-Type: text/plain;
name="backhand-handler.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="backhand-handler.patch"
Index: mod_backhand/back_util.c
===================================================================
RCS file: /storage/cvs/jesus/mod_backhand/back_util.c,v
retrieving revision 1.16
diff -u -r1.16 back_util.c
--- mod_backhand/back_util.c 2001/10/23 20:25:17 1.16
+++ mod_backhand/back_util.c 2001/10/24 18:56:43
@@ -163,13 +163,13 @@
time_t now = time(NULL);
mypid = getpid();
ap_rputs("<TABLE CELLSPACING=0 CELLPADDING=4 BORDER=0 BGCOLOR=#ffffff>\
-<TR bgcolor=#9999ee><TD><B align=center>Entry</B></TD><TD><B>Hostname</B></TD>\
-<TD align=right><B>Age</B></TD><TD align=center><B>Address</B></TD>\
-<TD align=right><B>Total Mem</B></TD><TD align=left><B>Avail Mem</B></TD>\
+<TR bgcolor=#9999ee><TD><B align=center>Entry</B></TD><TD align=center><B>Hostname</B></TD>\
+<TD align=center><B>Age</B></TD><TD align=center><B>Address</B></TD>\
+<TD align=center><B>Total Mem</B></TD><TD align=center><B>Avail Mem</B></TD>\
<TD align=center><B># ready servers/<BR># total servers</B></TD>\
<TD align=center><B>~ms/req [#req]</B></TD>\
-<TD align=right><B>Arriba</B></TD><TD align=center><B># CPUs</B></TD>\
-<TD align=right><B>Load/HWM</B></TD><TD align=right><B>CPU Idle</B></TD></TR>\n",
+<TD align=center><B>Arriba</B></TD><TD align=center><B># CPUs</B></TD>\
+<TD align=center><B>Load/HWM</B></TD><TD align=center><B>CPU Idle</B></TD></TR>\n",
r);
for(i=0;i<MAXSERVERS;i++) {
tempport = ntohs(serverstats[i].contact.sin_port);
@@ -180,18 +180,23 @@
hostaddress[21] = '\0';
if(serverstats[i].contact.sin_addr.s_addr!=0)
ap_rprintf(r, "<TR bgcolor=%s><TD align=center>%d</TD><TD>%s</TD>\
-<TD align=right>%d</TD><TD align=center>%s</TD><TD align=right>%d</TD>\
-<TD align=left>%d</TD><TD align=center>%d/%d</TD><TD align=center>%d [%d]</TD>\
+<TD align=right>%d</TD><TD align=center>%s</TD><TD align=right>%u MB</TD>\
+<TD align=right>%u MB</TD><TD align=center>%d/%d</TD><TD align=center>%d [%d]</TD>\
<TD align=right>%d</TD>\
-<TD align=center>%d</TD><TD align=right>%f/%d</TD><TD align=right>%f</TD></TR>\n",
+<TD align=center>%d</TD><TD align=right>%0.3f/%d</TD><TD align=right>%0.3f</TD></TR>\n",
(!is_alive(i,SERVER_TIMEOUT,now))?"#ff4444":
(i%2)?"#aaaaaa":"#cccccc",
i, /* Entry */
serverstats[i].hostname, /* hostname */
(int)(time(NULL) - serverstats[i].mtime), /* Age */
hostaddress, /* aaa.bbb.ccc.ddd:port */
- serverstats[i].tmem, /* Total physical memory */
- serverstats[i].amem, /* Avilable memory */
+
+ /* Total physical memory in megabytes */
+ ((unsigned int)serverstats[i].tmem)/(1024*1024),
+
+ /* Avilable memory in megabytes */
+ ((unsigned int)serverstats[i].amem)/(1024*1024),
+
serverstats[i].aservers, /* # ready Apache procs */
serverstats[i].nservers, /* # of Apache procs */
serverstats[i].tatime, /* Ave ms / request */
--------------050405090002070103060308--