Skip to content

Commit 1caed4e

Browse files
committed
Merge /httpd/httpd/trunk:r1923754
*) scoreboard/mod_http2: record durations of HTTP/2 requests. PR 69579 [Pierre Brochard <[email protected]>] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1926080 13f79535-47bb-0310-9956-ffa450edef68
1 parent fedf2e6 commit 1caed4e

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

changes-entries/pr69579.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*) scoreboard/mod_http2: record durations of HTTP/2 requests.
2+
PR 69579 [Pierre Brochard <[email protected]>]

include/ap_mmn.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,14 +609,15 @@
609609
* 20120211.137 (2.4.63-dev) Add AP_MPMQ_CAN_WAITIO
610610
* 20120211.138 (2.4.63-dev) Add is_host_matchable to proxy_worker_shared
611611
* 20120211.139 (2.4.63-dev) Add dav_get_base_path() to mod_dav
612+
* 20211221.140 (2.4.64-dev) Add ap_set_time_process_request() to scoreboard.h
612613
*/
613614

614615
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
615616

616617
#ifndef MODULE_MAGIC_NUMBER_MAJOR
617618
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
618619
#endif
619-
#define MODULE_MAGIC_NUMBER_MINOR 139 /* 0...n */
620+
#define MODULE_MAGIC_NUMBER_MINOR 140 /* 0...n */
620621

621622
/**
622623
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a

include/scoreboard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ AP_DECLARE(int) ap_update_child_status_from_server(ap_sb_handle_t *sbh, int stat
198198
AP_DECLARE(int) ap_update_child_status_descr(ap_sb_handle_t *sbh, int status, const char *descr);
199199

200200
AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status);
201-
201+
AP_DECLARE(void) ap_set_time_process_request(ap_sb_handle_t* const sbh,
202+
const apr_time_t timebeg,const apr_time_t timeend);
203+
202204
AP_DECLARE(int) ap_update_global_status(void);
203205

204206
AP_DECLARE(worker_score *) ap_get_scoreboard_worker(ap_sb_handle_t *sbh);

modules/http2/h2_mplx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <http_connection.h>
3030
#include <http_log.h>
3131
#include <http_protocol.h>
32+
#include <scoreboard.h>
3233

3334
#include <mpm_common.h>
3435

@@ -974,7 +975,9 @@ static void s_c2_done(h2_mplx *m, conn_rec *c2, h2_conn_ctx_t *conn_ctx)
974975
/* From here on, the final handling of c2 is done by c1 processing.
975976
* Which means we can give it c1's scoreboard handle for updates. */
976977
c2->sbh = m->c1->sbh;
977-
978+
#if AP_MODULE_MAGIC_AT_LEAST(20211221, 29)
979+
ap_set_time_process_request(c2->sbh,conn_ctx->started_at,conn_ctx->done_at);
980+
#endif
978981
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c2,
979982
"h2_mplx(%s-%d): request done, %f ms elapsed",
980983
conn_ctx->id, conn_ctx->stream_id,

server/scoreboard.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,22 @@ AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status)
653653
}
654654
}
655655

656+
AP_DECLARE(void) ap_set_time_process_request(ap_sb_handle_t* const sbh,
657+
const apr_time_t timebeg,const apr_time_t timeend)
658+
{
659+
if (!sbh || sbh->child_num < 0)
660+
return;
661+
662+
worker_score* const ws =
663+
&ap_scoreboard_image->servers[sbh->child_num][sbh->thread_num];
664+
665+
ws->start_time = timebeg;
666+
ws->stop_time = ws->last_used = timeend;
667+
668+
if (ap_extended_status)
669+
ws->duration += timeend - timebeg;
670+
}
671+
656672
AP_DECLARE(int) ap_update_global_status(void)
657673
{
658674
#ifdef HAVE_TIMES

0 commit comments

Comments
 (0)