Need a package to report CPU usage

Is there a package or some way to get CPU usage quickly?

"top -d 1" doesn't print CPU usage, top(1) takes ~1 second to start showing CPU usage. I need something to return CPU load under 100 ms.
 
fryshke said:
Is there a package or some way to get CPU usage quickly?

"top -d 1" doesn't print CPU usage, top(1) takes ~1 second to start showing CPU usage. I need something to return CPU load under 100 ms.

It might be an overkill to your problem but you can use net-mgmt/collectd that continuously monitors the system (you can even create nice graphs).
 
SirDice said:

vmstat reports 98% idle, while in top Samba is chuging 20% (seems reasonable as I started streaming HD movie on a downclocked AMD E-350) and top reports 80% idle. iostat id tab - also 98% http://i.imgur.com/Fq7Ji.jpg . systat is plainly wierd and doesn't cut it.

zhoopin said:
sysutils/asmon
An applet which monitors the CPU usage, memory and swap
Code:
[root@AeriePeak ~]# asmon
asmon: can't open display
Doesn't cut either.

izotov said:
It might be an overkill to your problem but you can use net-mgmt/collectd that continuously monitors the system (you can even create nice graphs).
I don't quite get if I'm getting trolled or what:
allows for frequent polling of values, with
support for polling as frequent as every 10 seconds.

Isn't there something simple like this? :/
izuQ1.jpg
 
Is LoadPercentage in Win PowerShell something akin to Load Average for *nix?

If so, and you find that acceptable, getloadavg from the stdlib is exposed in number of places:

# sysctl vm.loadavg
vm.loadavg: { 0.26 0.15 0.10 }

# uptime
12:18PM up 15:43, 8 users, load averages: 0.32, 0.17, 0.10

# w
12:17PM up 15:42, 8 users, load averages: 0.13, 0.13, 0.09


Or a Python script, callable from the command line:
# python -c "import os;print os.getloadavg()"
(0.1064453125, 0.1337890625, 0.0869140625)
 
if you still need it I can share a script I use for cacti, it runs top in batch mode for a couple of seconds (since on first start usage is blanked) and then it cuts the cpu usage data out of all the data. I couldnt find another way outside of using top to get the data.
 
mwatkins said:
Is LoadPercentage in Win PowerShell something akin to Load Average for *nix?

If so, and you find that acceptable, getloadavg from the stdlib is exposed in number of places:

# sysctl vm.loadavg
vm.loadavg: { 0.26 0.15 0.10 }

# uptime
12:18PM up 15:43, 8 users, load averages: 0.32, 0.17, 0.10

# w
12:17PM up 15:42, 8 users, load averages: 0.13, 0.13, 0.09


Or a Python script, callable from the command line:
# python -c "import os;print os.getloadavg()"
(0.1064453125, 0.1337890625, 0.0869140625)
Nope, it's CPU load.
chrcol said:
I couldnt find another way outside of using top to get the data.
Blergh. Gonna do some writing then.
 
Back
Top