CPU Monitoring
Linux Windows AIX Solaris
Linux'top' can give
you a overall view of CPU usage by process:
top - 23:50:16 up 3:25, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 88 total, 1 running, 87 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% us, 0.0% sy, 0.0% ni, 100.0% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 2055112k total, 227684k used, 1827428k free, 53556k buffers
Swap: 2096472k total, 0k used, 2096472k free, 100884k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 16 0 4876 596 500 S 0.0 0.0 0:00.78 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/2
7 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/3
9 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
11 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
12 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
The following keys are very useful:
Type '1' - displays all CPUs (if hyber-threaded, you will see them too)
Type 'c' - lists full command lines
|
'vmstat' can give you CPU info along with memory, io, and swap info:
# vmstat -a
procs memory swap io system cpu
r b swpd free inact active si so bi bo in cs us sy wa id
12 0 0 129600 3772736 2850908 0 0 3 15 14 39 4 1 1 39
- If runnable threads (r column) divided by the number of CPUs is greater than 1, there may be a CPU
bottleneck
- If us+sy is close to 100%, then there may be a CPU bottleneck. See action to determine next steps.
|
WindowsWindows Task
Manager can be used to monitor your system. You can start by
"Start->Run->(type) taskmgr and hit <Enter>"
This screen shows a 4-CPU system with average CPU usage 38%. Individual CPU usage is also shown clearly.
|
To automate and capture CPU usage into a file using 'perfmon' tool that comes
with Windows 2003, see "perf automation" section from the left navigation.
AIX
'sar' tells you overall system CPU usage, if you just want to know if your
system is busy or not, then use 'sar'.
# sar -u 10 3
AIX lpar05 2 5 00040B1F4C00 04/07/03
17:54:58 %usr %sys %wio %idle
17:55:08 30 57 1 12
17:55:18 29 57 1 12
17:55:28 26 43 1 29
Average 29 53 1 18
The output shows that the system spent 29% in user mode (your applications most likely), 53% in system
mode (OS-related, e.g., CPU-comsuming libraries), and 1% waiting for IO requests, and
was idle 18% of the time. If $usr + %sys = 100%, there may be a CPU bottleneck.
|
'vmstat' can be used to determine if there maybe a CPU bottleneck:
# vmstat 5 3
kthr memory page faults cpu
----- ----------- ------------------------ ------------ ---------------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
2 3 298565 163 0 14 58 2047 8594 0 971 217296 1286 43 56 17 34
2 2 298824 124 0 29 20 251 352 0 800 248079 1039 22 28 22 29
1 7 300027 293 0 15 6 206 266 0 1150 91086 479 7 14 9 69
- If runnable threads (r column) divided by the number of CPUs is greater than 1, there may be a CPU
bottleneck
- If us+sy is close to 100%, then there may be a CPU bottleneck. See action to determine next steps.
|
Solaris
To monitor for a total of 600 seconds (10 min) the CPU usage, open a terminal,
and type the following (5-second interval for 120 intervals):
# sar -A 5 120
SunOS ultra5 5.9 sun4u 05/14/2002
15:44:26 %usr %sys %wio %idle
15:44:31 1 2 0 97
15:44:36 1 2 0 96
15:44:41 9 2 9 80
15:44:46 2 3 0 95
15:44:51 0 1 0 99
15:44:56 3 2 0 96
15:45:01 0 0 0 100
15:45:06 15 0 0 85
15:45:11 2 0 0 97
|
|