gor@cs.strath.ac.uk (Gordon Russell) (06/25/91)
Hi there, Is there anyone out their who could supply me with some pointers on developing a C routine to calculate the current loading on a UNIX processor. Currently I am using the sun3 operating system, but I am looking for a generic routine. The best I can currently do is to get the user and system time for parent processes and for terminated children. What I would really like is complete processor loading (as a percentage) , perhaps with another routine returning percentage CPU time for one specified user. Does anyone have such routine(s) already written? If so, could you EMAIL them to me....All suggestions will appreciated for writing such routines. Thanx in advance. Gordon Russell , Research Student, University of Strathclyde.
jasonc@bnr.ca (Jason Chen) (06/26/91)
You may want to pull the p-table and the u-areas out from /dev/kmem, /dev/mem, and /dev/swap. You can use nlist(3c) to figure out addresses of the p-table and u-areas. Once you have the p-table and the u-areas, you will be able to calculate the current load. However, the code will be system dependent, if you do it this way. Jason -- Jason X.G. Chen Dept. 1B84, "WHY???" Ph: (613) 763-4844 Bell-Northern Research Ltd., Fax: (613) 763-2202 P.O. Box 3511, Station C, -Ancient Primate Email: jasonc@bnr.ca Ottawa, Ontario, Canada, K1Y 4H7 Question