mpstat工具可以查看CPU目前运行状态,输出格式如下:
# mpstat 5 10
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 80 7 0 225 123 114 2 0 0 0 202 1 1 3 96
手册说明:
CPU or SET Without the -a option, mpstat reports CPU, the proces-
sor ID. With the -a option, mpstat reports SET, the
processor set ID.
minf minor faults
mjf major faults
xcal inter-processor cross-calls
intr interrupts
ithr interrupts as threads (not counting clock interrupt)
csw context switches
icsw involuntary context switches
migr thread migrations (to another processor)
smtx spins on mutexes (lock not acquired on first try)
srw spins on readers/writer locks (lock not acquired on first try)
syscl system calls
usr percent user time
sys percent system time
参数解释如下:
CPU proces-sor ID || processor set ID
minf 轻微故障
mjf 重要故障
xcal CPU的交叉调用
intr 中断数
Ithr 线程中断数(不包括时钟中断)
csw 上下文切换数
icsw 强制的上下文切换次数
migr 线程的迁移数。
smtx spins on mutexes (lock not acquired on first try)
srw spins on readers/writer locks (lock not acquired on first try)
syscl 系统调用。
usr 用户的占用时间比率
sys 系统的占用时间比率
wt 系统的等待时间比率
idl 系统的空闲时间比率
smtx和srw可以通过lockstat来查看:
# lockstat sleep 5
Adaptive mutex spin: 20 events in 5.062 seconds (4 events/sec)
Count indv cuml rcnt nsec Lock Caller
-------------------------------------------------------------------------------
4 20% 20% 0.00 1490 0x6001144b000 timeout_common+0xc
3 15% 35% 0.00 11694 0x6001144b000 callout_execute+0xc8
3 15% 50% 0.00 1564 0x6001144b000 callout_execute+0x4
2 10% 60% 0.00 8800 0x60011433000 untimeout+0x20
2 10% 70% 0.00 7888 0x30001844000 untimeout+0x20
1 5% 75% 0.00 29092 0x60014b2dde8 glvc_intr+0x4
1 5% 80% 0.00 960 0x6001143c000 timeout_common+0xc
1 5% 85% 0.00 12620 0x60011433000 timeout_common+0xc
1 5% 90% 0.00 12416 pidlock thread_exit+0x98
1 5% 95% 0.00 61988 anonpages_hash_lock+0x68 anon_map_privatepages+0x1
0c
1 5% 100% 0.00 17796 0x30001844000 timeout_common+0xc
-------------------------------------------------------------------------------
Adaptive mutex block: 1 events in 5.062 seconds (0 events/sec)
Count indv cuml rcnt nsec Lock Caller
-------------------------------------------------------------------------------
1 100% 100% 0.00 28752 0x60014b2dde8 glvc_intr+0x4
-------------------------------------------------------------------------------
Spin lock spin: 2 events in 5.062 seconds (0 events/sec)
Count indv cuml rcnt nsec Lock Caller
-------------------------------------------------------------------------------
1 50% 50% 0.00 796 0x6001170de08 disp+0x7c
1 50% 100% 0.00 5940 0x60011676030 disp+0x7c
-------------------------------------------------------------------------------
Comments
There are currently no comments
New Comment