]> granicus.if.org Git - apache/commitdiff
Extract some more data through the server load API:
authorJoe Orton <jorton@apache.org>
Wed, 3 Oct 2012 08:20:50 +0000 (08:20 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 3 Oct 2012 08:20:50 +0000 (08:20 +0000)
* include/httpd.h (struct ap_sload_t): Add bytes_served, access_count
  fields.

* server/util.c (ap_get_sload): Fill in those fields.

Submitted by: Jan Kaluza <jkaluza redhat.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393338 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
server/util.c

index 44e97c3971102f3fd8c82d22f0fef537e0e1bd4a..51180da8110201dc09da42bbd8ed7f4162af6264 100644 (file)
@@ -1308,6 +1308,10 @@ struct ap_sload_t {
     int idle;
     /* percentage of process/threads busy (0->100) */
     int busy;
+    /* total bytes served */
+    apr_off_t bytes_served;
+    /* total access count */
+    unsigned long access_count;
 };
 
 /**
index 27ebfc141ed32496b2e93bb10397329f4f3feed5..1ae413e174f6f4c07d00837d3ee72d8be2796804 100644 (file)
@@ -2802,6 +2802,8 @@ AP_DECLARE(void) ap_get_sload(ap_sload_t *ld)
     /* preload errored fields, we overwrite */
     ld->idle = -1;
     ld->busy = -1;
+    ld->bytes_served = 0;
+    ld->access_count = 0;
 
     ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
     ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
@@ -2827,6 +2829,14 @@ AP_DECLARE(void) ap_get_sload(ap_sload_t *ld)
                     busy++;
                 }   
             }
+
+            if (ap_extended_status && !ps->quiescing && ps->pid) {
+                if (ws->access_count != 0 
+                    || (res != SERVER_READY && res != SERVER_DEAD)) {
+                    ld->access_count += ws->access_count;
+                    ld->bytes_served += ws->bytes_served;
+                }
+            }
         }
     }
     total = busy + ready;