]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CONTRIB: trace: add the possibility to place trace calls in the code
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Oct 2017 08:54:08 +0000 (10:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 24 Oct 2017 17:54:25 +0000 (19:54 +0200)
commit1296382d0bf7e600bbb60e927e546053d381e473
tree4bbed35a883978bdc8e1422a0fbb6137cbd0302d
parent796a2b3324907e0349c8dd071208dd621a528725
CONTRIB: trace: add the possibility to place trace calls in the code

Now any call to trace() in the code will automatically appear interleaved
with the call sequence and timestamped in the trace file. They appear with
a '#' on the 3rd argument (caller's pointer) in order to make them easy to
spot. If the trace functionality is not used, a dmumy weak function is used
instead so that it doesn't require to recompile every time traces are
enabled/disabled.

The trace decoder knows how to deal with these messages, detects them and
indents them similarly to the currently traced function. This can be used
to print function arguments for example.

Note that we systematically flush the log when calling trace() to ensure we
never miss important events, so this may impact performance.

The trace() function uses the same format as printf() so it should be easy
to setup during debugging sessions.
contrib/trace/trace.awk
include/common/standard.h
src/standard.c
src/trace.c