show individual cpu usage?

Hiten Pandya hmp at backplane.com
Fri Dec 16 06:06:47 PST 2005


Jeremy C. Reed wrote:
procps top(1) used on Linux can show individual CPUs like:

Tasks:  74 total,   3 running,  71 sleeping,   0 stopped,   0 zombie
  Cpu0 :  95.5% user,   4.2% system,   0.0% nice,   0.3% idle,   0.0% 
IO-wait
  Cpu1 :  95.5% user,   3.2% system,   0.0% nice,   1.3% idle,   0.0% 
IO-wait

I didn't see an option or doc in manpage for DragonFly's top(1).

I see NetBSD's manpage says: "On multi-processor systems, the STATE 
field may be followed by a slash and cpu number."

Any tool to show the individual cpu usage?
Okay, although I have not had the chance to integrate it with top, it
would be exactly what you want.  The utility is under the directory of
src/test/pcpu/.  It's called cpustat.c.
Just type 'make' in the that directory, and it will produce the binary
for you.  When you run the utility, it will give you something like
the following, sampled on package building machine:
pkgbox:/home/hmp> ./cpustat
2 cpus
CPU-0 state: 0.00% user, 0.00% nice, 0.00% sys, 0.00% intr, 100.00% idle
CPU-1 state: 2.34% user, 0.00% nice, 3.13% sys, 3.91% intr, 90.62% idle
CPU-0 state: 0.00% user, 0.00% nice, 0.00% sys, 0.78% intr, 99.22% idle
CPU-1 state: 2.34% user, 0.00% nice, 3.13% sys, 3.13% intr, 91.41% idle
CPU-0 state: 1.56% user, 0.00% nice, 0.00% sys, 3.12% intr, 95.31% idle
CPU-1 state: 0.00% user, 0.00% nice, 0.00% sys, 0.00% intr, 100.00% idle
CPU-0 state: 1.55% user, 0.00% nice, 0.00% sys, 11.63% intr, 86.82% idle
CPU-1 state: 0.00% user, 0.00% nice, 0.00% sys, 0.78% intr, 99.22% idle
Hope that helps.  It would be nice if someone has time to integrate the
code into top(1), make things a whole lot easier; the framework for
retrieving the information is already there in cpustat.c, just a matter
of fitting it with top(1) specific parts.
Regards,

Hiten Pandya
hmp at dragonflybsd.org





More information about the Users mailing list