From d6a7850200bb65b39602e74d17cc604247126086 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 27 May 2019 07:03:38 +0200 Subject: [PATCH] MINOR: cli/activity: add 3 general purpose counters in development mode The unused fd_del and fd_skip were being abused during debugging sessions as general purpose event counters. With their removal, let's officially have dedicated counters for such use cases. These counters are called "ctr0".."ctr2" and are listed at the end when DEBUG_DEV is set. --- include/types/activity.h | 6 ++++++ src/cli.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/types/activity.h b/include/types/activity.h index 2a6f5bd6a..618785da8 100644 --- a/include/types/activity.h +++ b/include/types/activity.h @@ -54,6 +54,12 @@ struct activity { unsigned int accepted; // accepted incoming connections unsigned int accq_pushed; // accept queue connections pushed unsigned int accq_full; // accept queue connection not pushed because full +#if defined(DEBUG_DEV) + /* keep these ones at the end */ + unsigned int ctr0; // general purposee debug counter + unsigned int ctr1; // general purposee debug counter + unsigned int ctr2; // general purposee debug counter +#endif char __pad[0]; // unused except to check remaining room char __end[0] __attribute__((aligned(64))); // align size to 64. }; diff --git a/src/cli.c b/src/cli.c index 118f8fd4c..39e246ebd 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1096,6 +1096,12 @@ static int cli_io_handler_show_activity(struct appctx *appctx) chunk_appendf(&trash, "\naccq_ring:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", (accept_queue_rings[thr].tail - accept_queue_rings[thr].head + ACCEPT_QUEUE_SIZE)%ACCEPT_QUEUE_SIZE); #endif +#if defined(DEBUG_DEV) + /* keep these ones at the end */ + chunk_appendf(&trash, "\nctr0:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].ctr0); + chunk_appendf(&trash, "\nctr1:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].ctr1); + chunk_appendf(&trash, "\nctr2:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].ctr2); +#endif chunk_appendf(&trash, "\n"); if (ci_putchk(si_ic(si), &trash) == -1) {