Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!execu!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F Haugh II) Newsgroups: comp.unix.wizards Subject: comp_t fields (was: Re: ccpu) Message-ID: <19230@rpp386.cactus.org> Date: 21 Apr 91 19:42:35 GMT References: <115829.28580@timbuk.cray.com> <16226.280f85ed@levels.sait.edu.au> Reply-To: jfh@rpp386.cactus.org (John F Haugh II) Organization: Lone Star Cat Emporium and BBQ Grill Lines: 33 X-Clever-Slogan: Help Prevent Robbery. Tax the IRS. In article <16226.280f85ed@levels.sait.edu.au> xtdn@levels.sait.edu.au writes: >Ray.Moody@Cray.Com writes: >> Ccpu is used compute a processes percent CPU utilization. It is a >> constant traditionally set to exp(-1/20). It is unusual in that it is >> one of the very few floating point numbers in the kernel. > >What about the comp_t fields in struct acct? They, while not floats, >are apparently floating point fields. So this doesn't turn into a discussion of floating point fields in the UNIX kernel ... The comp_t fields are not "floating point fields" in the traditional sense. They are a scaled representation of 32 bit integers that the system uses for various process accounting information. The function for decoding one of these gadgets is long uncompress(comp_t value) { return (value & 0x1fff) << ((value & 0xc000) >> 13); } The compress function is slightly more complex, but left as an exercise for the reader. As an aside, AIX/370 makes considerable use of floating point in the kernel, so watch out for those generalizations! -- John F. Haugh II | Distribution to | UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 255-8251 | GEnie PROHIBITED :-) | Domain: jfh@rpp386.cactus.org "If liberals interpreted the 2nd Amendment the same way they interpret the rest of the Constitution, gun ownership would be mandatory."