# CPU usage



## genius0815 (Oct 13, 2009)

Hi,

i need to know the cpu usage for user, system, idle and nice for _each_ CPU. How can i get this information?

wiht sysctl hw.ncpu i get the number of cpus
and with sysctl kern.cp_time the sum for all cpus

I need a list separated by cpu

Any idea?

greets


----------



## DutchDaemon (Oct 13, 2009)

[cmd=]top -P[/cmd] is a nice start ..


----------



## genius0815 (Oct 13, 2009)

I need a syscall like sysctlbyname

greets


----------



## DutchDaemon (Oct 13, 2009)

```
dev.cpu.0.cx_usage
dev.cpu.1.cx_usage
```
etc.

Use [cmd=]sysctl -n[/cmd] on those to get the values by themselves.


----------



## genius0815 (Oct 14, 2009)

Thats in % and not splitted in idle, user and system. Any other possibility?

greets genius


----------



## DutchDaemon (Oct 14, 2009)

Values under [cmd=]sysctl dev.cpu[/cmd] is all you get.


----------

