patched top(1) and kernel to support multiple CPU
前几天有人问 FreeBSD 的 top(1) 如何能够显示不同 CPU 的占用情况。这是 patch 过之后的输出:
last pid: 1773; load averages: 0.43, 0.19, 0.16 up 0+00:34:35 16:17:04
97 processes: 1 running, 96 sleeping
CPU 0: 20.8% user, 0.0% nice, 0.0% system, 0.0% interrupt, 79.2% idle
CPU 1: 3.1% user, 0.0% nice, 0.0% system, 0.0% interrupt, 96.9% idle
Mem: 517M Active, 21M Inact, 577M Wired, 11M Cache, 48K Buf, 810M Free
Swap: 2048M Total, 2048M Free
PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
1236 delphij 1 104 0 232M 143M select 1 4:37 37.06% Xorg
1768 delphij 1 8 0 164M 52704K nanslp 1 0:07 36.28% kicker
1771 delphij 1 8 0 6212K 1664K wait 0 0:00 3.17% sh
1772 delphij 1 45 0 8020K 1656K select 1 0:00 2.39% ksysguardd
1756 delphij 1 20 0 10648K 3596K pause 1 0:00 1.17% csh
1754 delphij 1 4 0 11764K 1588K sbwait 1 0:00 0.78% gnome-pty-helper
1751 delphij 2 -8 0 136M 25756K piperd 0 0:00 0.68% gnome-terminal
FreeBSD 8 中已经包含了这个功能。