]> git.ipfire.org Git - thirdparty/haproxy.git/commit
DEBUG: thread: make lock time computation more consistent
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Feb 2025 08:26:04 +0000 (09:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 10 Feb 2025 17:34:43 +0000 (18:34 +0100)
commit0b849c59fbd0091d4c2bfb1f7a6faa009573f6c5
treec3c9bf6d60dac096740a48309311460a92da76a3
parent99a88ee90465aa4015bfc388acf62cb66f0d19a2
DEBUG: thread: make lock time computation more consistent

The lock time computation was a bit inconsistent between functions,
particularly those using a try_lock. Some of them would count the lock
as taken without counting the time, others would simply not count it.
This is essentially due to the way the time is retrieved, as it was
done inside the atomic increment.

Let's instead always use start_time to carry the elapsed time, by
presetting it to the negative time before the event and addinf the
positive time after, so that it finally contains the duration. Then
depending on the try lock's success, we add the result or not. This
was generalized to all lock functions for consistency, and because
this will be handy for future changes.
src/thread.c