]> granicus.if.org Git - procps-ng/commit
library: fix an insidious bug affecting TICS_ALL_DELTA
authorJim Warner <james.warner@comcast.net>
Thu, 22 Apr 2021 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sat, 24 Apr 2021 01:11:03 +0000 (11:11 +1000)
commitc0827797692497ab1d3fc10696b850c81de0dd0c
treec9bd67134350cb372158bbdf1dad39d244d82196
parent0f691226ecaf706fbf7f1a28c9430bced88a3004
library: fix an insidious bug affecting TICS_ALL_DELTA

This simple two line code change fixes an intermittent
bug whereby %CPU for parent(s) with collapsed children
could be vastly understated from those displayed under
the current 3.3.17 publicly available top & libprocps.

If one started several top instances in the background
using very a small delay interval (zero?), then if the
shell under which they were running was collapsed, you
would see similar %CPU results for both the libraries.

However, when running a demanding 'make' like a kernel
compile (especially if backed by fast processors and a
SSD), then newlib would generally show only 1/3 to 1/2
of the collapsed %CPU values that appeared for 3.3.17.

Of course, now that the bug has been swatted with this
commit the disparities between those results is easily
explained. Since newly created tasks never contributed
tics during the interval where they were created, only
with many short lived tasks would differences surface.

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.c