MINOR: debug: add a new debug macro COUNT_IF()
authorWilly Tarreau <w@1wt.eu>
Mon, 21 Oct 2024 16:34:21 +0000 (18:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 9 Jan 2025 09:28:05 +0000 (10:28 +0100)
commit78d95ef75a1561303fc337a56fd937c0a57567c6
treea2bfdebc56aa60a50d4bf4cb5be67fd6ec89529f
parent6543e1e5487c3e87900f988a207e9929794ff6c4
MINOR: debug: add a new debug macro COUNT_IF()

This macro works exactly like BUG_ON() except that it never logs anything
nor crashes, it only implements an atomic counter that is incremented on
every call. This can be used to count a number of unlikely events that are
worth checking at run time on setups showing unusual and unreproducible
behaviors.

(cherry picked from commit da66c42f657855ec13f918ce37c9431cb2922e8d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/bug.h