procps/ps
Jim Warner 20e44569f5 ps: improved three elapsed 'jiffies/tics' calculations
With openSUSE's tumbleweed release of procps-ng-4.0.0,
their source rpm contained a questionable patch. It is
ostensibly devoted to increasing the accuracy for %cpu
calculations in the ps program. However, in my opinion
it goes too far and is quite flawed for these reasons:

1. Six separate files were impacted instead of just 1.
2. While ps was the object, libproc-2 was changed too.
3. A header file's alphabetic item order was violated.
4. The library API and ABI were altered unnecessarily.

It should be noted that all the <pids> TIME items were
made 'real' when representing seconds so that they can
be converted into jiffies/tics if multiplied by hertz.
Thus, there was absolutely no justification for adding
a new PIDS_TICS_ELAPSED ull_int item to the interface.

As an example, assuming a hertz value of 100, there is
enough capacity in all of those 'TIME' seconds to hold
nearly 3 million years worth of tics without a loss of
precision whenever they are changed back into jiffies.

[ that's nine quadrillion seven trillion one hundred ]
[ ninety-nine billion two hundred fifty-four million ]
[ seven hundred forty thousand nine hundred ninety + ]
[ one! or more concisely, as: 9,007,199,254,740,991. ]

So, any need for increased accuracy in that ps program
can be realized within the single output.c file alone.

That's what will be accomplished with this new commit.

And for any doubters here's a 'double' capacity proof:

beg ------ 9007199254740991.000000000000000000000 tic|
 d /= 100, 90071992547409.90625000000000000000000 sec
 d /=  60, 1501199875790.165039062500000000000000 min
 d /=  60, 25019997929.83608245849609375000000000 hrs
 d /=  24, 1042499913.743170142173767089843750000 day
 d /=   7, 148928559.1061671674251556396484375000 wks
 d /=  52, 2864010.752041676081717014312744140625 yrs
 d *=  52, 148928559.1061671674251556396484375000 wks
 d *=   7, 1042499913.743170142173767089843750000 day
 d *=  24, 25019997929.83608245849609375000000000 hrs
 d *=  60, 1501199875790.165039062500000000000000 min
 d *=  60, 90071992547409.90625000000000000000000 sec
 d *= 100, 9007199254740991.000000000000000000000 tic
end ------ 9007199254740991.000000000000000000000  " |

[ who knows, maybe we'll even convince openSUSE that ]
[ the original sledgehammer 'dif' should be dropped. ]

Reference(s):
. openSUSE equivalent: 'procps-ng-4.0.0-accuracy.dif'

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00
..
common.h ps: plus for symmetry 'UTILIZATION_C' is newest format 2022-03-07 20:29:06 +11:00
COPYING license: update FSF addresses 2012-03-04 08:04:24 +11:00
display.c ps: restore thread display when using a pidlist option 2022-04-01 17:13:25 +11:00
global.c ps: plus for symmetry 'UTILIZATION_C' is newest format 2022-03-07 20:29:06 +11:00
HACKING docs: remove old information from HACKING 2012-01-13 22:42:38 +01:00
help.c library: cleanup of library includes 2016-04-16 17:03:57 +10:00
output.c ps: improved three elapsed 'jiffies/tics' calculations 2022-04-17 10:43:19 +10:00
parser.c ps: eliminated inadvertent trailing double semi-colons 2020-04-10 14:37:15 +10:00
ps.1 ps: plus for symmetry 'UTILIZATION_C' is newest format 2022-03-07 20:29:06 +11:00
regression procps 010114 2002-02-01 22:47:29 +00:00
select.c ps: Match on truncated 16 char for -C 2020-09-24 22:19:11 +10:00
sortformat.c ps: that restored aix behavior gets its ultimate tweak 2022-04-17 10:43:19 +10:00
stacktrace.c misc: just eliminate several 'unused' warning messages 2016-07-26 07:59:48 +10:00