httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1389565 - /httpd/httpd/trunk/modules/metadata/mod_headers.c
Date Mon, 24 Sep 2012 20:51:01 GMT
Author: jim
Date: Mon Sep 24 20:51:00 2012
New Revision: 1389565

URL: http://svn.apache.org/viewvc?rev=1389565&view=rev
Log:
Allow for exposure of loadavg and server load via mod_headers

Modified:
    httpd/httpd/trunk/modules/metadata/mod_headers.c

Modified: httpd/httpd/trunk/modules/metadata/mod_headers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_headers.c?rev=1389565&r1=1389564&r2=1389565&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_headers.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_headers.c Mon Sep 24 20:51:00 2012
@@ -220,6 +220,27 @@ static const char *header_request_ssl_va
     }
 }
 
+static const char *header_request_loadavg(request_rec *r, char *a)
+{
+    ap_loadavg_t t;
+    ap_get_loadavg(&t);
+    return apr_psprintf(r->pool, "l=%.2f", t.loadavg);
+}
+
+static const char *header_request_idle(request_rec *r, char *a)
+{
+    ap_sload_t t;
+    ap_get_sload(&t);
+    return apr_psprintf(r->pool, "i=%d", t.idle);
+}
+
+static const char *header_request_busy(request_rec *r, char *a)
+{
+    ap_sload_t t;
+    ap_get_sload(&t);
+    return apr_psprintf(r->pool, "b=%d", t.busy);
+}
+
 /*
  * Config routines
  */
@@ -905,6 +926,9 @@ static int header_pre_config(apr_pool_t 
     register_format_tag_handler("t", header_request_time);
     register_format_tag_handler("e", header_request_env_var);
     register_format_tag_handler("s", header_request_ssl_var);
+    register_format_tag_handler("l", header_request_loadavg);
+    register_format_tag_handler("i", header_request_idle);
+    register_format_tag_handler("b", header_request_busy);
 
     return OK;
 }



Mime
View raw message