]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
procs_running: added rationale into comments 3243/head
authorBart De Vos <bart-de-vos@telenet.be>
Sun, 1 Mar 2020 20:27:20 +0000 (21:27 +0100)
committerBart De Vos <bart-de-vos@telenet.be>
Sun, 1 Mar 2020 20:27:20 +0000 (21:27 +0100)
src/processes.c

index cf78de905d1ef501a17f65178c418627909ee8e0..e9f18f424ce5fac39d96228bb405d5571c850288 100644 (file)
@@ -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);