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.
SirDice said:
zhoopin said:sysutils/asmon
An applet which monitors the CPU usage, memory and swap
[root@AeriePeak ~]# asmon
asmon: can't open display
I don't quite get if I'm getting trolled or what: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).
allows for frequent polling of values, with
support for polling as frequent as every 10 seconds.
# 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
# python -c "import os;print os.getloadavg()"
(0.1064453125, 0.1337890625, 0.0869140625)
Nope, it's CPU load.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)
Blergh. Gonna do some writing then.chrcol said:I couldnt find another way outside of using top to get the data.