diff options
author | Donald Sharp <sharpd@nvidia.com> | 2021-02-02 18:56:06 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-03-26 16:41:57 +0100 |
commit | 039d547f6f1b7fe4b96cc22ac5a6ef8d18d5cf97 (patch) | |
tree | f5614f80d048b8a3c4906f06284c45ef6373ec60 /lib/thread.c | |
parent | Merge pull request #8154 from AnuradhaKaruppiah/evpn-mh-irb-2 (diff) | |
download | frr-039d547f6f1b7fe4b96cc22ac5a6ef8d18d5cf97.tar.xz frr-039d547f6f1b7fe4b96cc22ac5a6ef8d18d5cf97.zip |
lib: Differentiate between real and cpu bound processes
When generating SLOW_THREAD warnings let's differentiate between
a cpu bound process and a wall bound process. Effectively
a slow thread can now be a process in FRR doing lots of work( cpu bound )
or wall bound ( the cpu is heavy load and a FRR process may be pre-empted
and never scheduled ).
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/thread.c')
-rw-r--r-- | lib/thread.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/thread.c b/lib/thread.c index 866090341..7a3d50419 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1850,15 +1850,29 @@ void thread_call(struct thread *thread) memory_order_seq_cst); #ifdef CONSUMED_TIME_CHECK - if (realtime > CONSUMED_TIME_CHECK) { + if (cputime > CONSUMED_TIME_CHECK) { /* - * We have a CPU Hog on our hands. + * We have a CPU Hog on our hands. The time FRR + * has spent doing actual work ( not sleeping ) + * is greater than 5 seconds. * Whinge about it now, so we're aware this is yet another task * to fix. */ flog_warn( - EC_LIB_SLOW_THREAD, - "SLOW THREAD: task %s (%lx) ran for %lums (cpu time %lums)", + EC_LIB_SLOW_THREAD_CPU, + "CPU HOG: task %s (%lx) ran for %lums (cpu time %lums)", + thread->xref->funcname, (unsigned long)thread->func, + realtime / 1000, cputime / 1000); + } else if (realtime > CONSUMED_TIME_CHECK) { + /* + * The runtime for a task is greater than 5 seconds, but + * the cpu time is under 5 seconds. Let's whine + * about this because this could imply some sort of + * scheduling issue. + */ + flog_warn( + EC_LIB_SLOW_THREAD_WALL, + "STARVATION: task %s (%lx) ran for %lums (cpu time %lums)", thread->xref->funcname, (unsigned long)thread->func, realtime / 1000, cputime / 1000); } |