diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-02-02 12:56:06 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-03-26 11:41:57 -0400 |
| commit | 039d547f6f1b7fe4b96cc22ac5a6ef8d18d5cf97 (patch) | |
| tree | f5614f80d048b8a3c4906f06284c45ef6373ec60 /lib/thread.c | |
| parent | 694df37daf95940e923905fdd1096541d860bbfd (diff) | |
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 866090341e..7a3d50419f 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); } |
