]> granicus.if.org Git - procps-ng/commit
library: guard against 'inf/nan' for 'cpu utilization'
authorJim Warner <james.warner@comcast.net>
Thu, 3 Mar 2022 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Sun, 6 Mar 2022 03:52:34 +0000 (14:52 +1100)
commit9c0e8e9429d232a85baef3d6fa8269963fd80741
treebd8d5ab79f82d88335c32e479fa745880fcdba95
parent5c4c23925715b13412588fe8b39efcb1eb5ade4e
library: guard against 'inf/nan' for 'cpu utilization'

When preparing the ps program for a %CUU field, it was
revealed the PIDS_UTILIZATION item may sometimes yield
a result of 'nan' or 'inf' for that ps program itself.

Apparently, it was caused by the short lived nature of
such a one-shot program. And, while this anomaly could
be handled in ps, the solution belongs in the library.

So, I reworked an item's algorithm to avoid this oops.

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