MINOR: sink: add processed events counter in sft

Add a new struct member to sft structure named e_processed in order to
track the total number of events processed by sft applets.

sink_forward_oc_io_handler() and sink_forward_io_handler() now make use
of ring_dispatch_messages() optional value added in the previous commit
in order to increase the number of processed events.
This commit is contained in:
Aurelien DARRAGON 2024-07-22 15:24:26 +02:00
parent 47323e64ad
commit 709b3db941
2 changed files with 4 additions and 1 deletions

View File

@ -40,6 +40,7 @@ struct sink_forward_target {
struct server *srv; // used server struct server *srv; // used server
struct appctx *appctx; // appctx of current session struct appctx *appctx; // appctx of current session
size_t ofs; // ring buffer reader offset size_t ofs; // ring buffer reader offset
size_t e_processed; // processed events
struct sink *sink; // the associated sink struct sink *sink; // the associated sink
struct sink_forward_target *next; struct sink_forward_target *next;
__decl_thread(HA_SPINLOCK_T lock); // lock to protect current struct __decl_thread(HA_SPINLOCK_T lock); // lock to protect current struct

View File

@ -353,6 +353,7 @@ static void _sink_forward_io_handler(struct appctx *appctx,
struct sink *sink = sft->sink; struct sink *sink = sft->sink;
struct ring *ring = sink->ctx.ring; struct ring *ring = sink->ctx.ring;
size_t ofs, last_ofs; size_t ofs, last_ofs;
size_t processed;
int ret = 0; int ret = 0;
if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) { if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) {
@ -383,7 +384,8 @@ static void _sink_forward_io_handler(struct appctx *appctx,
MT_LIST_DELETE(&appctx->wait_entry); MT_LIST_DELETE(&appctx->wait_entry);
ret = ring_dispatch_messages(ring, appctx, &sft->ofs, &last_ofs, 0, ret = ring_dispatch_messages(ring, appctx, &sft->ofs, &last_ofs, 0,
msg_handler, NULL); msg_handler, &processed);
sft->e_processed += processed;
if (ret) { if (ret) {
/* let's be woken up once new data arrive */ /* let's be woken up once new data arrive */