Skip to content
Browse files

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 <jkaluza redhat.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393338 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 72fc6e5 commit 501d655cfe6981cee4da872f96f22e42f34b6f36 @notroj notroj committed Oct 3, 2012
Showing with 14 additions and 0 deletions.
  1. +4 −0 include/httpd.h
  2. +10 −0 server/util.c
View
4 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;
};
/**
View
10 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;

0 comments on commit 501d655

Please sign in to comment.
Something went wrong with that request. Please try again.