On 4/8/24 18:51, Chris Torek wrote:
Chris Torek of UofMaryland.
I got it into 4.3-Reno.  I did not come up with the whole thing but
Rehmi Post and I worked out how to compute %cpu without using floating
point (the original VAX-only version used FP but we had to stop doing
that when we were worried about porting to systems that lacked kernel
access to FP).

The version in current FreeBSD is fancier now though.

Chris

Around 1981 I put a similar calculation into 2BSD for the PDP-11 with no floating point, but this was for the system load average, not the %cpu. It just imputes a decimal point in the middle of what the processor considers an integer.

Thanks,

      Mary Ann Horton (she/her/ma'am)
      Award Winning Author
      maryannhorton.com