summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorPatrick Ruddy <pat@voltanet.io>2021-04-14 18:33:18 +0100
committerGitHub <noreply@github.com>2021-04-14 18:33:18 +0100
commit5bb91468c55c17405d112ffe91ba01594583c2e6 (patch)
tree10edf4414da92a455cdbc49d43d4f58a07bab3d6 /lib/vty.c
parent8a0a716f83c1eecafb8d3a3c7cbf0b153b8c4280 (diff)
parent9b8e01cae44cf6cb3a1a08c483ab0deceda21375 (diff)
Merge pull request #8003 from donaldsharp/timings
lib: Differentiate between real and cpu bound processes
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 96cfef1c0a..f92c912084 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -515,13 +515,19 @@ static int vty_command(struct vty *vty, char *buf)
#ifdef CONSUMED_TIME_CHECK
GETRUSAGE(&after);
- if ((realtime = thread_consumed_time(&after, &before, &cputime))
- > CONSUMED_TIME_CHECK)
+ realtime = thread_consumed_time(&after, &before, &cputime);
+ if (cputime > CONSUMED_TIME_CHECK) {
/* Warn about CPU hog that must be fixed. */
flog_warn(
- EC_LIB_SLOW_THREAD,
- "SLOW COMMAND: command took %lums (cpu time %lums): %s",
+ EC_LIB_SLOW_THREAD_CPU,
+ "CPU HOG: command took %lums (cpu time %lums): %s",
realtime / 1000, cputime / 1000, buf);
+ } else if (realtime > CONSUMED_TIME_CHECK) {
+ flog_warn(
+ EC_LIB_SLOW_THREAD_WALL,
+ "STARVATION: command took %lums (cpu time %lums): %s",
+ realtime / 1000, cputime / 1000, buf);
+ }
}
#endif /* CONSUMED_TIME_CHECK */