]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli/activity: add 3 general purpose counters in development mode
authorWilly Tarreau <w@1wt.eu>
Mon, 27 May 2019 05:03:38 +0000 (07:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 May 2019 05:03:38 +0000 (07:03 +0200)
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
src/cli.c

index 2a6f5bd6afa843f27df9dfd65fcdba78d80a1d97..618785da863abdd49476696f16b51659edcf54dd 100644 (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.
 };
index 118f8fd4cca0259acc102d302b7f93f386129461..39e246ebd3c986acf6c5142fb24f5737667c5a56 100644 (file)
--- 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) {