]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stream/sched: take into account CPU profiling for the last call
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Sep 2022 14:17:49 +0000 (16:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Sep 2022 12:19:15 +0000 (14:19 +0200)
commitbeee600491c15861a923113ee322c9f57aba07e5
tree2cb7fd3b3c94931cd619e9fe5cf5e7c5cac4fbba
parent1efddfa6bfdcaf57198866db67e49b40442d278f
BUG/MINOR: stream/sched: take into account CPU profiling for the last call

When task profiling is enabled, the reported CPU time for short requests
and responses (e.g. redirect) is always zero in the logs, because
process_stream() is only called once and the CPU time is measured after
it returns. This is particuarly annoying when dealing with denies and in
general anything that deals with parasitic traffic because it can be
difficult to figure where the CPU is spent.

The solution taken in this patch consists in having process_stream()
update the cpu time itself before logging and quitting. It's very simple.
It will not take into account the time taken to produce the log nor
freeing the stream, but that's marginal compared to always logging zero.
The task's wake_date is also reset so that the scheduler doesn't have to
perform these operations again. This is dependent on the following patch:

   MINOR: sched: store the current profile entry in the thread context

It should be backported to 2.6 as it does help for troubleshooting.
src/stream.c