From 12b0842c0975b679110fd55ab2176ea983047796 Mon Sep 17 00:00:00 2001 From: Bart De Vos Date: Sun, 1 Mar 2020 21:27:20 +0100 Subject: [PATCH] procs_running: added rationale into comments --- src/processes.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/processes.c b/src/processes.c index cf78de905..e9f18f424 100644 --- a/src/processes.c +++ b/src/processes.c @@ -2119,7 +2119,14 @@ static int ps_read(void) { closedir(proc); - /* get procs_running from /proc/stat */ + /* get procs_running from /proc/stat + * scanning /proc/stat AND computing other process stats takes too much time. + * Consequently, the number of running processes based on the occurences + * of 'R' as character indicating the running state is typically zero. Due + * to processes are actually changing state during the evaluation of it's + * stat(s). + * The 'procs_running' number in /proc/stat on the other hand is more + * accurate, and can be retrieved in a single 'read' call. */ running = procs_running(); ps_submit_state("running", running); -- 2.47.2