MINOR: task/debug: make task_queue() and task_schedule() possible callers
authorWilly Tarreau <w@1wt.eu>
Thu, 9 Nov 2023 11:05:08 +0000 (12:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 9 Nov 2023 16:24:00 +0000 (17:24 +0100)
commita13f8425f068880117085c02bd004dc0e68dc55a
treee73c5968ebc096874c4e2bcb7c76ae9c2afd4fb0
parent0eb0914dbabef74ece8327de669652357bf8802a
MINOR: task/debug: make task_queue() and task_schedule() possible callers

It's common to see process_stream() being woken up by wake_expired_tasks
in the profiling output, without knowing which timeout was set to cause
this. By making it possible to record the call places of task_queue()
and task_schedule(), and by making wake_expired_tasks() explicitly not
replace it, we'll be able to know which task_queue() or task_schedule()
was triggered for a given wakeup.

For example below:
  process_stream                51200   311.4ms   6.081us   34.59s    675.6us <- run_tasks_from_lists@src/task.c:659 task_queue
  process_stream                19227   70.00ms   3.640us   9.813m    30.62ms <- sc_notify@src/stconn.c:1136 task_wakeup
  process_stream                 6414   102.3ms   15.95us   8.093m    75.70ms <- stream_new@src/stream.c:578 task_wakeup

It's visible that it's the run_tasks_from_lists() which in fact applies
on the task->expire returned by the ->process() function itself.
include/haproxy/task-t.h
include/haproxy/task.h
src/task.c