From 44cb0020912465aa281f19f6a5d26a030a059e31 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Wed, 3 Oct 2012 08:20:50 +0000 Subject: [PATCH] Extract some more data through the server load API: * 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393338 13f79535-47bb-0310-9956-ffa450edef68 --- include/httpd.h | 4 ++++ server/util.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/httpd.h b/include/httpd.h index 44e97c3971..51180da811 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -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; }; /** diff --git a/server/util.c b/server/util.c index 27ebfc141e..1ae413e174 100644 --- a/server/util.c +++ b/server/util.c @@ -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; -- 2.49.0