MINOR: trace: implement tracing disabling API
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 17 Dec 2024 15:28:16 +0000 (16:28 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Jan 2025 10:21:59 +0000 (11:21 +0100)
commit13cfd4eef76a8ade6f4b602d30b92742d0fc11f7
tree87a0d424e127032b30a2432cd392473363309fd8
parent4193eca9e3211efbfdfa55090e336bb4f5bd74cc
MINOR: trace: implement tracing disabling API

Define a set of functions to temporarily disable/reactivate tracing for
the current thread. This could be useful when wanting to quickly remove
tracing output for some code parts.

The API relies on a disable/resume set of functions, with a thread-local
counter. This counter is tested under __trace_enabled(). It is a
cumulative value so that the same count of resume must be issued after
several disable usage. There is also the possibility to force reset the
counter to 0 before restoring the old value.

This should be backported up to 3.1.

(cherry picked from commit 9d155ca7064290d3280621c85443221fa13334b2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/tinfo-t.h
include/haproxy/trace.h
src/trace.c