Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 16281 invoked from network); 8 Oct 2009 21:42:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Oct 2009 21:42:45 -0000 Received: (qmail 32171 invoked by uid 500); 8 Oct 2009 21:42:45 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 32096 invoked by uid 500); 8 Oct 2009 21:42:45 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 32087 invoked by uid 99); 8 Oct 2009 21:42:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2009 21:42:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2009 21:42:35 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 063E623888CF; Thu, 8 Oct 2009 21:42:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r823337 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_core.h modules/loggers/mod_logio.c server/scoreboard.c Date: Thu, 08 Oct 2009 21:42:13 -0000 To: cvs@httpd.apache.org From: sf@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091008214214.063E623888CF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sf Date: Thu Oct 8 21:42:13 2009 New Revision: 823337 URL: http://svn.apache.org/viewvc?rev=823337&view=rev Log: mod_logio: introduce new optional function ap_logio_get_last_bytes to get total byte count of last request. core: Use ap_logio_get_last_bytes to report more accurate byte counts in mod_status if mod_logio is loaded. Without mod_logio, don't increment counts for HEAD requests. PR: 25656 Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/include/ap_mmn.h httpd/httpd/trunk/include/http_core.h httpd/httpd/trunk/modules/loggers/mod_logio.c httpd/httpd/trunk/server/scoreboard.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=823337&r1=823336&r2=823337&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Thu Oct 8 21:42:13 2009 @@ -10,6 +10,9 @@ mod_proxy_ftp: NULL pointer dereference on error paths. [Stefan Fritsch , Joe Orton] + *) mod_logio/core: Report more accurate byte counts in mod_status if + mod_logio is loaded. PR 25656. [Stefan Fritsch] + *) mod_ldap: If LDAPSharedCacheSize is too small, try harder to purge some cache entries and log a warning. Also increase the default LDAPSharedCacheSize to 500000. This is a more realistic size suitable Modified: httpd/httpd/trunk/include/ap_mmn.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=823337&r1=823336&r2=823337&view=diff ============================================================================== --- httpd/httpd/trunk/include/ap_mmn.h (original) +++ httpd/httpd/trunk/include/ap_mmn.h Thu Oct 8 21:42:13 2009 @@ -198,15 +198,17 @@ * 20090401.3 (2.3.3-dev) Added DAV options provider to mod_dav.h * 20090925.0 (2.3.3-dev) Added server_rec::context and added *server_rec * param to ap_wait_or_timeout() + * 20090925.1 (2.3.3-dev) Add optional function ap_logio_get_last_bytes() to + * mod_logio * */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20090401 +#define MODULE_MAGIC_NUMBER_MAJOR 20090925 #endif -#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a Modified: httpd/httpd/trunk/include/http_core.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=823337&r1=823336&r2=823337&view=diff ============================================================================== --- httpd/httpd/trunk/include/http_core.h (original) +++ httpd/httpd/trunk/include/http_core.h Thu Oct 8 21:42:13 2009 @@ -646,6 +646,8 @@ APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_in, (conn_rec *c, apr_off_t bytes)); +APR_DECLARE_OPTIONAL_FN(apr_off_t, ap_logio_get_last_bytes, (conn_rec *c)); + /* ---------------------------------------------------------------------- * * ident lookups with mod_ident Modified: httpd/httpd/trunk/modules/loggers/mod_logio.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_logio.c?rev=823337&r1=823336&r2=823337&view=diff ============================================================================== --- httpd/httpd/trunk/modules/loggers/mod_logio.c (original) +++ httpd/httpd/trunk/modules/loggers/mod_logio.c Thu Oct 8 21:42:13 2009 @@ -53,6 +53,7 @@ typedef struct logio_config_t { apr_off_t bytes_in; apr_off_t bytes_out; + apr_off_t bytes_last_request; } logio_config_t; /* @@ -76,6 +77,18 @@ } /* + * Optional function to get total byte count of last request for + * ap_increment_counts. + */ + +static apr_off_t ap_logio_get_last_bytes(conn_rec *c) +{ + logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module); + + return cf->bytes_last_request; +} + +/* * Format items... */ @@ -104,6 +117,8 @@ logio_config_t *cf = ap_get_module_config(r->connection->conn_config, &logio_module); + /* need to save byte count of last request for ap_increment_counts */ + cf->bytes_last_request = cf->bytes_in + cf->bytes_out; cf->bytes_in = cf->bytes_out = 0; return OK; @@ -173,6 +188,7 @@ APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_out); APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_in); + APR_REGISTER_OPTIONAL_FN(ap_logio_get_last_bytes); } module AP_MODULE_DECLARE_DATA logio_module = Modified: httpd/httpd/trunk/server/scoreboard.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=823337&r1=823336&r2=823337&view=diff ============================================================================== --- httpd/httpd/trunk/server/scoreboard.c (original) +++ httpd/httpd/trunk/server/scoreboard.c Thu Oct 8 21:42:13 2009 @@ -64,6 +64,8 @@ *pfn_proxy_lb_workers; static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) *pfn_proxy_lb_worker_size; +static APR_OPTIONAL_FN_TYPE(ap_logio_get_last_bytes) + *pfn_ap_logio_get_last_bytes; struct ap_sb_handle_t { int child_num; @@ -116,6 +118,8 @@ if (lb_limit && lb_size) scoreboard_size += lb_size * lb_limit; + pfn_ap_logio_get_last_bytes = APR_RETRIEVE_OPTIONAL_FN(ap_logio_get_last_bytes); + return scoreboard_size; } @@ -350,11 +354,21 @@ AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r) { worker_score *ws; + apr_off_t bytes; if (!sb) return; ws = &ap_scoreboard_image->servers[sb->child_num][sb->thread_num]; + if (pfn_ap_logio_get_last_bytes != NULL) { + bytes = pfn_ap_logio_get_last_bytes(r->connection); + } + else if (r->method_number == M_GET && r->method[0] == 'H') { + bytes = 0; + } + else { + bytes = r->bytes_sent; + } #ifdef HAVE_TIMES times(&ws->times); @@ -362,9 +376,9 @@ ws->access_count++; ws->my_access_count++; ws->conn_count++; - ws->bytes_served += r->bytes_sent; - ws->my_bytes_served += r->bytes_sent; - ws->conn_bytes += r->bytes_sent; + ws->bytes_served += bytes; + ws->my_bytes_served += bytes; + ws->conn_bytes += bytes; } AP_DECLARE(int) ap_find_child_by_pid(apr_proc_t *pid)