Author: rjung
Date: Fri Oct  3 14:43:59 2008
New Revision: 701543

URL: http://svn.apache.org/viewvc?rev=701543&view=rev
Log:
Add display of seconds since last statistics reset
to status worker.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
    tomcat/connectors/trunk/jk/native/common/jk_shm.h
    tomcat/connectors/trunk/jk/native/common/jk_status.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=701543&r1=701542&r2=701543&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Fri Oct  3 
14:43:59 2008
@@ -2576,6 +2576,7 @@
         if(p->maintain_time < 0)
             p->maintain_time = 0;
         p->s->last_maintain_time = time(NULL);
+        p->s->last_reset = p->s->last_maintain_time;
 
         if (JK_IS_DEBUG_LEVEL(l)) {
 

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=701543&r1=701542&r2=701543&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Fri Oct  3 14:43:59 
2008
@@ -1332,9 +1332,9 @@
                 }
                 if (p->states[rec->i] == JK_LB_STATE_ERROR)
                     jk_log(l, JK_LOG_INFO,
-                           "service failed, %sworker %s is in error state",
-                           rec->s->state == JK_LB_STATE_ERROR ? "entire " : "",
-                           rec->name);
+                           "service failed, worker %s is in %serror state",
+                           rec->name,
+                           rec->s->state == JK_LB_STATE_ERROR ? "" : "local ");
                 if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
                     jk_shm_unlock();
             }
@@ -1607,6 +1607,7 @@
     if(p->maintain_time < 0)
         p->maintain_time = 0;
     p->s->last_maintain_time = time(NULL);
+    p->s->last_reset = p->s->last_maintain_time;
 
     p->lbmethod = jk_get_lb_method(props, p->name);
     p->lblock   = jk_get_lb_lock(props, p->name);

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?rev=701543&r1=701542&r2=701543&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Fri Oct  3 14:43:59 2008
@@ -94,7 +94,7 @@
     volatile int busy;
     /* Maximum number of busy channels */
     volatile int max_busy;
-    volatile time_t  error_time;
+    volatile time_t error_time;
     /* Number of bytes read from remote */
     volatile jk_uint64_t readed;
     /* Number of bytes transferred to remote */
@@ -109,7 +109,9 @@
     volatile jk_uint32_t  reply_timeouts;
     /* Number of client errors */
     volatile jk_uint32_t  client_errors;
-    volatile time_t  last_maintain_time;
+    /* Last reset time */
+    volatile time_t last_reset;
+    volatile time_t last_maintain_time;
 };
 typedef struct jk_shm_ajp_worker jk_shm_ajp_worker_t;
 
@@ -139,7 +141,7 @@
     /* Current lb value  */
     volatile jk_uint64_t lb_value;
     /* Statistical data */
-    volatile time_t  error_time;
+    volatile time_t error_time;
     /* Number of times the worker was elected - snapshot during maintenance */
     volatile jk_uint64_t  elected_snapshot;
     /* Number of non 200 responses */
@@ -164,7 +166,9 @@
     int     lbmethod;
     int     lblock;
     unsigned int max_packet_size;
-    volatile time_t  last_maintain_time;
+    /* Last reset time */
+    volatile time_t last_reset;
+    volatile time_t last_maintain_time;
     /* Session cookie */
     char    session_cookie[JK_SHM_STR_SIZ+1];
     /* Session path */

Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?rev=701543&r1=701542&r2=701543&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Fri Oct  3 14:43:59 
2008
@@ -244,7 +244,7 @@
                                            "<th>State</th>" \
                                            "<th>Acc</th>" \
                                            
"<th>Err</th><th>CE</th><th>RE</th>" \
-                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th>" \
+                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th><th>LR</th>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_AJP_ROW             "<tr>" \
                                            "<td>%s</td>" \
@@ -256,6 +256,7 @@
                                            "<td>%s</td>" \
                                            "<td>%d</td>" \
                                            "<td>%d</td>" \
+                                           "<td>%d</td>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_LB_HEAD             "<tr>" \
                                            "<th>Type</th>" \
@@ -286,7 +287,7 @@
                                            
"<th>Err</th><th>CE</th><th>RE</th>" \
                                            
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th>" \
                                            "<th>" JK_STATUS_ARG_LBM_TEXT_ROUTE 
"</th>" \
-                                           "<th>RR</th><th>Cd</th><th>Rs</th>" 
\
+                                           
"<th>RR</th><th>Cd</th><th>Rs</th><th>LR</th>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_MEMBER_ROW          "<td>%s</td>" \
                                            "<td>%s</td>" \
@@ -307,6 +308,7 @@
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
                                            "<td>%d/%d</td>" \
+                                           "<td>%d</td>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_MEMBER_CONF_HEAD    "<tr>" \
                                            "<th>Name</th><th>Type</th>" \
@@ -1693,7 +1695,8 @@
                       wr->redirect ? (*wr->redirect ? wr->redirect : "&nbsp;") 
: "&nbsp",
                       wr->domain ? (*wr->domain ? wr->domain : "&nbsp;") : 
"&nbsp",
                       rs_min,
-                      rs_max);
+                      rs_max,
+                      (int)difftime(now, aw->s->last_reset));
         else
             jk_printf(s, JK_STATUS_SHOW_AJP_ROW,
                       jk_ajp_get_state(aw, l),
@@ -1704,7 +1707,8 @@
                       status_strfsize(aw->s->transferred, buf_wr),
                       status_strfsize(aw->s->readed, buf_rd),
                       aw->s->busy,
-                      aw->s->max_busy);
+                      aw->s->max_busy,
+                      (int)difftime(now, aw->s->last_reset));
 
     }
     else if (mime == JK_STATUS_MIME_XML) {
@@ -1763,6 +1767,8 @@
         }
         else
             jk_print_xml_att_int(s, off+2, "map_count", map_count);
+        jk_print_xml_att_long(s, off+2, "last_reset_at", 
(long)aw->s->last_reset);
+        jk_print_xml_att_int(s, off+2, "last_reset_ago", (int)difftime(now, 
aw->s->last_reset));
         /* Terminate the tag */
         jk_print_xml_stop_elt(s, off, 1);
 
@@ -1820,6 +1826,8 @@
         }
         else
             jk_printf(s, " map_count=%d", map_count);
+        jk_printf(s, " last_reset_at=%ld", (long)aw->s->last_reset);
+        jk_printf(s, " last_reset_ago=%d", (int)difftime(now, 
aw->s->last_reset));
         jk_puts(s, "\n");
 
     }
@@ -1873,6 +1881,8 @@
         }
         else
             jk_print_prop_att_int(s, w, name, "map_count", map_count);
+        jk_print_prop_att_long(s, w, name, "last_reset_at", 
(long)aw->s->last_reset);
+        jk_print_prop_att_int(s, w, name, "last_reset_ago", (int)difftime(now, 
aw->s->last_reset));
 
     }
     JK_TRACE_EXIT(l);
@@ -2057,7 +2067,7 @@
 
         if (!hide_lb_summary) {
             jk_puts(s, "<table><tr>"
-                    
"<th>Good</th><th>Degraded</th><th>Bad/Stopped</th><th>Busy</th><th>Max 
Busy</th><th>Next Maintenance</th><th>[");
+                    
"<th>Good</th><th>Degraded</th><th>Bad/Stopped</th><th>Busy</th><th>Max 
Busy</th><th>Next Maintenance</th><th>Last Reset</th><th>[");
             status_write_uri(s, p, "Hide", JK_STATUS_CMD_UNKNOWN, 
JK_STATUS_MIME_UNKNOWN,
                              NULL, NULL, JK_STATUS_ARG_OPTION_NO_LB_SUMMARY, 
0, NULL, l);
             jk_puts(s, "]</th></tr>\n<tr>");
@@ -2067,6 +2077,7 @@
             jk_printf(s, "<td>%d</td>", lb->s->busy);
             jk_printf(s, "<td>%d</td>", lb->s->max_busy);
             jk_printf(s, "<td>%d/%d</td>", ms_min, ms_max);
+            jk_printf(s, "<td>%d</td>", (int)difftime(now, lb->s->last_reset));
             jk_puts(s, "<td></td></tr>\n</table>\n\n");
         }
     }
@@ -2091,6 +2102,8 @@
         jk_print_xml_att_int(s, 4, "map_count", map_count);
         jk_print_xml_att_int(s, 4, "time_to_maintenance_min", ms_min);
         jk_print_xml_att_int(s, 4, "time_to_maintenance_max", ms_max);
+        jk_print_xml_att_long(s, 4, "last_reset_at", (long)lb->s->last_reset);
+        jk_print_xml_att_int(s, 4, "last_reset_ago", (int)difftime(now, 
lb->s->last_reset));
         jk_print_xml_stop_elt(s, 2, 0);
 
     }
@@ -2115,6 +2128,8 @@
         jk_printf(s, " map_count=%d", map_count);
         jk_printf(s, " time_to_maintenance_min=%d", ms_min);
         jk_printf(s, " time_to_maintenance_max=%d", ms_max);
+        jk_printf(s, " last_reset_at=%ld", (long)lb->s->last_reset);
+        jk_printf(s, " last_reset_ago=%d", (int)difftime(now, 
lb->s->last_reset));
         jk_puts(s, "\n");
 
     }
@@ -2138,6 +2153,8 @@
         jk_print_prop_att_int(s, w, name, "map_count", map_count);
         jk_print_prop_att_int(s, w, name, "time_to_maintenance_min", ms_min);
         jk_print_prop_att_int(s, w, name, "time_to_maintenance_max", ms_max);
+        jk_print_prop_att_long(s, w, name, "last_reset_at", 
(long)lb->s->last_reset);
+        jk_print_prop_att_int(s, w, name, "last_reset_ago", (int)difftime(now, 
lb->s->last_reset));
 
     }
 
@@ -3372,6 +3389,7 @@
             "<tr><th>RR</th><td>Route redirect</td></tr>\n"
             "<tr><th>Cd</th><td>Cluster domain</td></tr>\n"
             "<tr><th>Rs</th><td>Recovery scheduled in app. min/max 
seconds</td></tr>\n"
+            "<tr><th>LR</th><td>Seconds since last reset of statistics 
counters</td></tr>\n"
             "</tbody>\n"
             "</table>\n");
     }
@@ -3840,6 +3858,7 @@
     lb_worker_t *lb = NULL;
     lb_sub_worker_t *wr = NULL;
     ajp_worker_t *aw = NULL;
+    time_t now = 0;
 
     JK_TRACE_ENTER(l);
     fetch_worker_and_sub_worker(p, "resetting", &worker, &sub_worker, l);
@@ -3848,6 +3867,7 @@
         return JK_FALSE;
     }
 
+    now = time(NULL);
     if (jw->type == JK_LB_WORKER_TYPE) {
         if (check_valid_lb(s, p, jw, worker, &lb, 0, l) == JK_FALSE) {
             JK_TRACE_EXIT(l);
@@ -3860,6 +3880,7 @@
                        "Status worker '%s' %s lb worker '%s' with all sub 
workers",
                        w->name, "resetting", lb->name);
             lb->s->max_busy = 0;
+            lb->s->last_reset = now;
             for (i = 0; i < lb->num_of_workers; i++) {
                 wr = &(lb->lb_workers[i]);
                 aw = (ajp_worker_t *)wr->worker->worker_private;
@@ -3874,6 +3895,7 @@
                 aw->s->transferred      = 0;
                 aw->s->readed           = 0;
                 aw->s->max_busy         = 0;
+                aw->s->last_reset       = now;
             }
             JK_TRACE_EXIT(l);
             return JK_TRUE;
@@ -3900,6 +3922,7 @@
             aw->s->transferred      = 0;
             aw->s->readed           = 0;
             aw->s->max_busy         = 0;
+            aw->s->last_reset       = now;
             JK_TRACE_EXIT(l);
             return JK_TRUE;
         }
@@ -3919,6 +3942,7 @@
             aw->s->transferred      = 0;
             aw->s->readed           = 0;
             aw->s->max_busy         = 0;
+            aw->s->last_reset       = now;
             JK_TRACE_EXIT(l);
             return JK_TRUE;
         }

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=701543&r1=701542&r2=701543&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Fri Oct  3 
14:43:59 2008
@@ -43,6 +43,9 @@
   <br />
   <subsection name="Native">
     <changelog>
+      <update>
+        Status: Add display of seconds since last statistics reset. (rjung)
+      </update>
       <add>
         AJP13: Add a configurable retry wait time. (rjung)
       </add>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to