Skip to content

Commit e3d014c

Browse files
committed
*) 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/trunk@1923754 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3af0d14 commit e3d014c

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
@@ -734,14 +734,15 @@
734734
* 20211221.26 (2.5.1-dev) Add is_host_matchable to proxy_worker_shared
735735
* 20211221.27 (2.5.1-dev) Add sock_proto to proxy_worker_shared, and AP_LISTEN_MPTCP
736736
* 20211221.28 (2.5.1-dev) Add dav_get_base_path() to mod_dav
737+
* 20211221.29 (2.5.1-dev) Add ap_set_time_process_request() to scoreboard.h
737738
*/
738739

739740
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
740741

741742
#ifndef MODULE_MAGIC_NUMBER_MAJOR
742743
#define MODULE_MAGIC_NUMBER_MAJOR 20211221
743744
#endif
744-
#define MODULE_MAGIC_NUMBER_MINOR 28 /* 0...n */
745+
#define MODULE_MAGIC_NUMBER_MINOR 29 /* 0...n */
745746

746747
/**
747748
* 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
@@ -197,7 +197,9 @@ AP_DECLARE(int) ap_update_child_status_from_server(ap_sb_handle_t *sbh, int stat
197197
AP_DECLARE(int) ap_update_child_status_descr(ap_sb_handle_t *sbh, int status, const char *descr);
198198

199199
AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status);
200-
200+
AP_DECLARE(void) ap_set_time_process_request(ap_sb_handle_t* const sbh,
201+
const apr_time_t timebeg,const apr_time_t timeend);
202+
201203
AP_DECLARE(int) ap_update_global_status(void);
202204

203205
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

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

server/scoreboard.c

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

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

0 commit comments

Comments
 (0)