From 23d3b00bdd389effb4cdf77de432ad769359bd2c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 22 Oct 2020 08:00:09 +0200 Subject: [PATCH] MINOR: threads/debug: only report used lock stats The lock stats are very verbose and more than half of them are used in a typical test, making it hard to spot the sought values. Let's simply report "not used" for those which have not been called at all. --- include/haproxy/thread.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index 810eb6f46..84571217c 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -454,6 +454,15 @@ static inline void show_lock_stats() int lbl; for (lbl = 0; lbl < LOCK_LABELS; lbl++) { + if (!lock_stats[lbl].num_write_locked && + !lock_stats[lbl].num_seek_locked && + !lock_stats[lbl].num_read_locked) { + fprintf(stderr, + "Stats about Lock %s: not used\n", + lock_label(lbl)); + continue; + } + fprintf(stderr, "Stats about Lock %s: \n" "\t # write lock : %lu\n"