Skip to content

Commit

Permalink
*) scoreboard/mod_http2: record durations of HTTP/2 requests.
Browse files Browse the repository at this point in the history
     PR 69579 [Pierre Brochard <[email protected]>]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923754 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
icing committed Feb 12, 2025
1 parent 3af0d14 commit e3d014c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changes-entries/pr69579.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*) scoreboard/mod_http2: record durations of HTTP/2 requests.
PR 69579 [Pierre Brochard <[email protected]>]
3 changes: 2 additions & 1 deletion include/ap_mmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,15 @@
* 20211221.26 (2.5.1-dev) Add is_host_matchable to proxy_worker_shared
* 20211221.27 (2.5.1-dev) Add sock_proto to proxy_worker_shared, and AP_LISTEN_MPTCP
* 20211221.28 (2.5.1-dev) Add dav_get_base_path() to mod_dav
* 20211221.29 (2.5.1-dev) Add ap_set_time_process_request() to scoreboard.h
*/

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

#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20211221
#endif
#define MODULE_MAGIC_NUMBER_MINOR 28 /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 29 /* 0...n */

/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Expand Down
4 changes: 3 additions & 1 deletion include/scoreboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ AP_DECLARE(int) ap_update_child_status_from_server(ap_sb_handle_t *sbh, int stat
AP_DECLARE(int) ap_update_child_status_descr(ap_sb_handle_t *sbh, int status, const char *descr);

AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status);

AP_DECLARE(void) ap_set_time_process_request(ap_sb_handle_t* const sbh,
const apr_time_t timebeg,const apr_time_t timeend);

AP_DECLARE(int) ap_update_global_status(void);

AP_DECLARE(worker_score *) ap_get_scoreboard_worker(ap_sb_handle_t *sbh);
Expand Down
5 changes: 4 additions & 1 deletion modules/http2/h2_mplx.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <http_connection.h>
#include <http_log.h>
#include <http_protocol.h>
#include <scoreboard.h>

#include <mpm_common.h>

Expand Down Expand Up @@ -975,7 +976,9 @@ static void s_c2_done(h2_mplx *m, conn_rec *c2, h2_conn_ctx_t *conn_ctx)
/* From here on, the final handling of c2 is done by c1 processing.
* Which means we can give it c1's scoreboard handle for updates. */
c2->sbh = m->c1->sbh;

#if AP_MODULE_MAGIC_AT_LEAST(20211221, 29)
ap_set_time_process_request(c2->sbh,conn_ctx->started_at,conn_ctx->done_at);
#endif
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c2,
"h2_mplx(%s-%d): request done, %f ms elapsed",
conn_ctx->id, conn_ctx->stream_id,
Expand Down
16 changes: 16 additions & 0 deletions server/scoreboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,22 @@ AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status)
}
}

AP_DECLARE(void) ap_set_time_process_request(ap_sb_handle_t* const sbh,
const apr_time_t timebeg,const apr_time_t timeend)
{
if (!sbh || sbh->child_num < 0)
return;

worker_score* const ws =
&ap_scoreboard_image->servers[sbh->child_num][sbh->thread_num];

ws->start_time = timebeg;
ws->stop_time = ws->last_used = timeend;

if (ap_extended_status)
ws->duration += timeend - timebeg;
}

AP_DECLARE(int) ap_update_global_status(void)
{
#ifdef HAVE_TIMES
Expand Down

0 comments on commit e3d014c

Please sign in to comment.