Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ccnysci.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!hjuxa!petsd!peora!codas!akguc!akgua!gatech!seismo!cmcl2!rna!rocky2!cucard!ccnysci!joe From: joe@ccnysci.UUCP Newsgroups: net.bugs.4bsd Subject: problem in iostat program -- Bug and fix. Message-ID: <176@ccnysci.UUCP> Date: Tue, 3-Dec-85 10:02:22 EST Article-I.D.: ccnysci.176 Posted: Tue Dec 3 10:02:22 1985 Date-Received: Fri, 6-Dec-85 07:18:21 EST Organization: City College of New York Lines: 20 The iostat program in the 4.2 BSD release apparently works fine until you use it on a system which has been up for several days. After that the first line of information (the summary of performance since last reboot) shows one or more states (USER, NICE, SYSTEM, IDLE) active for a negative percent of the time. The bug is in the subroutine stat1, where the times are multiplied by an integer 100, causing overflow into the sign bit for long times. Forcing a multiplication of double quantities fixes the problem. The single line correction (within stat1 in file iostat.c) is -------------------------------------------------- CUT ------------ 210c210 > printf("%3.0f", 100*s.cp_time[o]/time); --- < printf("%3.0f", 100.0*s.cp_time[o]/time); --------------------------------------------------- CUT ----------- Joe Eccles -- City College of New York philabs!cucard!ccnysci!joe ihnp4!physics!ccnysci!joe