Date: Sat, 11 Mar 2000 14:26:02 -0300 (EST) From: Felipe Paulo Guazzi Bergo <guazzibe@dcc.unicamp.br> To: hackers@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: Getting CPU usage in FreeBSD Message-ID: <Pine.GSO.4.10.10003111424050.6579-100000@xingu.dcc.unicamp.br>
next in thread | raw e-mail | index | archive | help
Hi, I am the author of gPS (http://gps.seul.org) and I'm trying to finish the FreeBSD native poller. All I need now is a routine to get the CPU usage. My program needs it every quarter of second, so the loadavg value is not enough accurate for me. (the objective is the CPU/memory history window shown in the third screenshot at the website) I've already looked at the source of top but couldn't get much from there. On Linux this is what I do to get this value: Measure the number of scheduled jiffies (hundreths of second), measure elapsed time since last measurement, divide. What I need is a scheduler-oriented cpu usage poller. I have already found some symbols in the kernel that may provide this value, but I couldn't get them to scale in a closed range (when I though I got the correct factor, I got CPU usages of 1280 % and the like). I am using FreeBSD-3.4-RELEASE/i386 for development, and would like to code to be portable for the widest range of FreeBSD versions possible. Can someone help me with code or good reference ? Thanks, ......................................................................... Felipe Paulo Guazzi Bergo, undergradute in Computer Engineering guazzibe@dcc.unicamp.br || bergo@seul.org || bergo@linuxstart.com Unicamp - Campinas - SP - Brazil - Earth To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10003111424050.6579-100000>