From: Rainer Jung Date: Fri, 31 Aug 2018 19:13:38 +0000 (+0000) Subject: mod_status: Add cumulated response duration time X-Git-Tag: 2.4.35~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6065602845187203e9c8e2414292d40749fa7243;p=thirdparty%2Fapache%2Fhttpd.git mod_status: Add cumulated response duration time in milliseconds. Backport of remaining parts of r1837590 from trunk (only html mode changes, auto parts were already backported). Submitted by: rjung Reviewed by: rjung, jim, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1839785 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 366091e57e8..040296d511d 100644 --- a/CHANGES +++ b/CHANGES @@ -10,8 +10,7 @@ Changes with Apache 2.4.35 "ProxyStatus" is "On": add "busy" count and show byte counts in auto mode always in units of kilobytes. [Rainer Jung] - *) mod_status: Add cumulated response duration time in milliseconds - to auto mode. + *) mod_status: Add cumulated response duration time in milliseconds. [Rainer Jung] *) mod_status: Complete the data shown for async MPMs in "auto" mode. diff --git a/STATUS b/STATUS index 71db044fb1c..c281e532777 100644 --- a/STATUS +++ b/STATUS @@ -210,15 +210,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK: 2.4.x patch: https://home.apache.org/~jim/patches/response-204-304.patch +1: jim, ylavic - *) mod_status: Add cumulated response duration time - in milliseconds to html mode. The auto mode part - has already been backported. - This changes the HTML output format for the server-status - but adds the very useful request duration metric. - trunk: http://svn.apache.org/r1837590 (remaining parts) - 2.4.x patch: https://home.apache.org/~rjung/patches/httpd-2.4.x-server-status-html-duration-r1837590-part2.patch - +1: rjung, jim, ylavic - *) MPMs: Initialize all runtime/asynchronous objects on a dedicated pool and before signals handling to avoid lifetime issues on restart or shutdown. PR 62658. diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index e9da4dc8109..5dd8e119973 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -194,6 +194,7 @@ static int status_handler(request_rec *r) apr_off_t bcount, kbcount; long req_time; apr_time_t duration_global; + apr_time_t duration_slot; int short_report; int no_table_report; global_score *global_record; @@ -508,7 +509,7 @@ static int status_handler(request_rec *r) else { /* !short_report */ ap_rprintf(r, "
Total accesses: %lu - Total Traffic: ", count); format_kbyte_out(r, kbcount); - ap_rputs("
\n", r); + ap_rprintf(r, " - Total Duration: %" APR_TIME_T_FMT "\n", duration_global / 1000); #ifdef HAVE_TIMES /* Allow for OS/2 not having CPU stats */ @@ -537,7 +538,8 @@ static int status_handler(request_rec *r) ap_rputs(" - ", r); format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount / (float) count)); - ap_rputs("/request", r); + ap_rprintf(r, "/request - %g ms/request", + (float) duration_global / (float) count / 1000.); } ap_rputs("\n", r); @@ -715,7 +717,7 @@ static int status_handler(request_rec *r) #ifdef HAVE_TIMES "CPU\n" #endif - "SSReq" + "SSReqDur" "ConnChildSlot" "ClientProtocolVHost" "Request\n\n", r); @@ -747,6 +749,7 @@ static int status_handler(request_rec *r) bytes = ws_record->bytes_served; my_bytes = ws_record->my_bytes_served; conn_bytes = ws_record->conn_bytes; + duration_slot = ws_record->duration; if (ws_record->pid) { /* MPM sets per-worker pid and generation */ worker_pid = ws_record->pid; worker_generation = ws_record->generation; @@ -813,7 +816,7 @@ static int status_handler(request_rec *r) #ifdef HAVE_TIMES "u%g s%g cu%g cs%g" #endif - "\n %ld %ld (", + "\n %ld %ld %" APR_TIME_T_FMT "(", #ifdef HAVE_TIMES ws_record->times.tms_utime / tick, ws_record->times.tms_stime / tick, @@ -822,7 +825,8 @@ static int status_handler(request_rec *r) #endif (long)apr_time_sec(nowtime - ws_record->last_used), - (long) req_time); + (long) req_time, + duration_slot / 1000); format_byte_out(r, conn_bytes); ap_rputs("|", r); @@ -902,7 +906,7 @@ static int status_handler(request_rec *r) #ifdef HAVE_TIMES "%.2f" #endif - "%ld%ld", + "%ld%ld%" APR_TIME_T_FMT, #ifdef HAVE_TIMES (ws_record->times.tms_utime + ws_record->times.tms_stime + @@ -911,7 +915,8 @@ static int status_handler(request_rec *r) #endif (long)apr_time_sec(nowtime - ws_record->last_used), - (long)req_time); + (long)req_time, + duration_slot / 1000); ap_rprintf(r, "%-1.1f%-2.2f%-2.2f\n", (float)conn_bytes / KBYTE, (float) my_bytes / MBYTE, @@ -947,6 +952,7 @@ static int status_handler(request_rec *r) "SSSeconds since beginning of most recent request\n \ ReqMilliseconds required to process most recent request\n \ +DurSum of milliseconds required to process all requests\n \ ConnKilobytes transferred this connection\n \ ChildMegabytes transferred this child\n \ SlotTotal megabytes transferred this slot\n \