]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads/debug: only report used lock stats
authorWilly Tarreau <w@1wt.eu>
Thu, 22 Oct 2020 06:00:09 +0000 (08:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 22 Oct 2020 15:32:28 +0000 (17:32 +0200)
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

index 810eb6f4648bafbacf579355bdec99fa82c3daf3..84571217c52bd400768e82dae3f283d681270b29 100644 (file)
@@ -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"