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.
This commit is contained in:
Willy Tarreau 2019-05-27 07:03:38 +02:00
parent 394c9b4215
commit d6a7850200
2 changed files with 12 additions and 0 deletions

View File

@ -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.
};

View File

@ -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) {