0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 20:58:44 +00:00

Softened warning about too much time spent in loop

Now the warning needs at least 10 ms after the scheduled end time
to ever complain.

TODO: make this configurable
This commit is contained in:
Maria Matejka 2024-06-04 10:10:35 +02:00
parent 5d6c4ff35a
commit 423eaf3438

View File

@ -152,7 +152,7 @@ static _Thread_local uint birdloop_wakeup_masked_count;
#define LOOP_TRACE(loop, fmt, args...) do { if (config && config->latency_debug) log(L_TRACE "%s (%p): " fmt, LOOP_NAME(loop), (loop), ##args); } while (0)
#define THREAD_TRACE(...) do { if (config && config->latency_debug) log(L_TRACE "Thread: " __VA_ARGS__); } while (0)
#define LOOP_WARN(loop, fmt, args...) log(L_TRACE "%s (%p): " fmt, LOOP_NAME(loop), (loop), ##args)
#define LOOP_WARN(loop, fmt, args...) log(L_WARN "%s (%p): " fmt, LOOP_NAME(loop), (loop), ##args)
event_list *
@ -1465,8 +1465,8 @@ birdloop_run(void *_loop)
/* Now we can actually do some work */
u64 dif = account_to(&loop->working);
if (dif > this_thread->max_loop_time_ns)
LOOP_WARN(loop, "locked %lu ns after its scheduled end time", dif);
if (dif > this_thread->max_loop_time_ns + config->latency_limit TO_NS)
LOOP_WARN(loop, "locked %lu us after its scheduled end time", dif NS TO_US);
uint repeat, loop_runs = 0;
do {