From: Bart De Vos Date: Sun, 1 Mar 2020 20:27:20 +0000 (+0100) Subject: procs_running: added rationale into comments X-Git-Tag: collectd-5.11.0~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12b0842c0975b679110fd55ab2176ea983047796;p=thirdparty%2Fcollectd.git procs_running: added rationale into comments --- 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);