httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1675533 - in /httpd/httpd/trunk: docs/manual/mod/mod_log_config.xml modules/loggers/mod_log_config.c
Date Thu, 23 Apr 2015 03:12:30 GMT
Author: breser
Date: Thu Apr 23 03:12:30 2015
New Revision: 1675533

URL: http://svn.apache.org/r1675533
Log:
mod_log_config: Add %M format to output request duration in milliseconds.


Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
    httpd/httpd/trunk/modules/loggers/mod_log_config.c

Modified: httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml?rev=1675533&r1=1675532&r2=1675533&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml Thu Apr 23 03:12:30 2015
@@ -146,6 +146,9 @@
     <tr><td><code>%m</code></td>
         <td>The request method.</td></tr>
 
+    <tr><td><code>%M</code></td>
+        <td>The time taken to serve the request, in milliseconds.</td></tr>
+
     <tr><td><code>%{<var>VARNAME</var>}n</code></td>
         <td>The contents of note <var>VARNAME</var> from another
         module.</td></tr>

Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=1675533&r1=1675532&r2=1675533&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Thu Apr 23 03:12:30 2015
@@ -101,6 +101,7 @@
  * %...{format}t:  The time, in the form given by format, which should
  *                 be in strftime(3) format.
  * %...T:  the time taken to serve the request, in seconds.
+ * %...M:  the time taken to serve the request, in milliseconds
  * %...D:  the time taken to serve the request, in micro seconds.
  * %...u:  remote user (from auth; may be bogus if return status (%s) is 401)
  * %...U:  the URL path requested.
@@ -802,6 +803,13 @@ static const char *log_request_duration(
     return apr_psprintf(r->pool, "%" APR_TIME_T_FMT, apr_time_sec(duration));
 }
 
+static const char *log_request_duration_milliseconds(request_rec *r, char *a)
+{
+    apr_time_t duration = get_request_end_time(r) - r->request_time;
+    return apr_psprintf(r->pool, "%" APR_TIME_T_FMT, apr_time_as_msec(duration));
+}
+
+
 static const char *log_request_duration_microseconds(request_rec *r, char *a)
 {
     return apr_psprintf(r->pool, "%" APR_TIME_T_FMT,
@@ -1837,6 +1845,7 @@ static int log_pre_config(apr_pool_t *p,
         log_pfn_register(p, "k", log_requests_on_connection, 0);
         log_pfn_register(p, "r", log_request_line, 1);
         log_pfn_register(p, "D", log_request_duration_microseconds, 1);
+        log_pfn_register(p, "M", log_request_duration_milliseconds, 1);
         log_pfn_register(p, "T", log_request_duration, 1);
         log_pfn_register(p, "U", log_request_uri, 1);
         log_pfn_register(p, "s", log_status, 1);



Mime
View raw message