Solaris学习笔记(1)
Solaris学习笔记(1)
作者: Badcoffee
Email: blog.oliver@gmail.com
Blog: http://blog.csdn.net/yayong
2005年6月
这方面比较好的参考资料有:
1. Solaris internal
Jim Mauro and Richard McDougall写的这部书实在是太经典了,第一版是有中文版的,
第二版马上也要出了。下面是这本书的网站,上面有作者的blog和
http://www.solarisinternals.com
2. Sun官方文档站点
http://docs.sun.com
Solaris的man手册,还有很多有用的学习资料
下面就是我学习mpstat命令的笔记,就先从这里开始吧。
mpstat(1M)
NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXAMPLES | ATTRIBUTES | SEE ALSO | NOTES
NAME
- mpstat– report per-processor or per-processor-set statistics
报告每个处理器或者每个处理器集合的统计数据
SYNOPSIS
- /usr/bin/mpstat [-aq] [-p| -Pset] [interval [count]]
DESCRIPTION
- mpstat命令报告如下信息:
- CPU or SET
Without the -a option, mpstat reports CPU statistics for a processor ID. With the -a option, mpstat reports SET statistics for a processor set ID.
- 没有-a选项,mpstat以处理器ID来报告CPU统计数据。有-a选项,mpstat以SET
(处理器集合)ID来报告SET统计数据 - 问题:什么是SET?它与CPU差别?
The mpstat command reports processor statistics in tabular form. Each row of the table represents the activity of one processor. The first table summarizes all activity since boot. Each subsequent table summarizes activity for the preceding interval. All values are rates listed as events per second unless otherwise noted.
mpstat命令以列表形式报告处理器统计数据。表格的每行对应一
During execution of the kernel status command, the state of the kernel can change. If relevant, a state change message is included in the mpstat output, in one of the following forms:
在执行内核状态命令时,内核的状态会改变。如果相关
<<processor 3 moved from pset: -1 to: 1>> |
The mpstat command reports the following information:
器集合上。详细信息可以看psrset(1M)。例如,可以创建一个具有两个 CPU 的处
理器集,将我们的关键应用的进程与该处理器集绑定。另外,禁止该处理器集中的
CPU 上的中断,从而不会有中断发生在该处理器集中的处理器上。这样,这2个
CPU就只为我们的关键应用服务了,从而保证服务稳定而且高效。
- minf
minor faults
- 辅助错误minor faults个数
- mjf
major faults
- 主要错误major faults个数
Solaris虚拟内存管理是借助MMU来实现的
major page faults、minor page faults、protection faults
major page faults发生在试图访问一个虚拟内存单元,该单元虽已经被ma
到Solaris的某个段映像,但是并不存在于物理内存中,这时
缺页中断(x86)或者trap(sparc),导致内核处理程序
哪个段。如果不属于任何一个段则给进程发送一个段错误SIGSEG
调用该段驱动程序的page-fault例程。调用该例程的结果可
1. 该内存存在于swap区,段驱动通过vnode的getpage函
到物理内存
2. 该内存从未被使用,需要新生成该页
minor page faults发生在试图访问一个虚拟内存单元,该单元已经被map
Solaris的某个段映像,并且已经存在于物理内存
空间转换关系。例如系统种的共享库,就属于这种情形,实际上多个进程只
同一共享库的物理内存页,第一个引用共享库的进程导致一个major page faults,
而之后的其它进程引用则只是minor page faults,attach在该库的物理内存上。
protection faults发生在试图访问一个虚拟内存单元,该单元访问方式与所
访问方式相悖。例如写程序的代码段将会导致该错误。
- xcal
inter-processor cross-calls
- 交叉调用cross-calls的数目。
交叉调用即cross-calls(xcalls)
应用于MMU的TLB coherency任务,CPU控制,或者强制一个CPU进入内核
例如,在一个用户进程提交一个unmap的操作,会通过cross
将MMU的TLB中的入口删除。
- 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)
- 在互斥锁mutexes上的自旋(即第一次试图获得锁未果)的次数
- srw
spins on readers/writer locks (lock not acquired on first try)
- syscl
system calls
- usr
percent user time
- sys
percent system time
- wt
time CPUs are idle pending I/O operations. See the NOTES section for more information on wt time.
- CPU等待IO操作的空闲时间。更多信息参考 NOTES小节的wt时间
- idl
percent idle time
- sze
number of processors in the requested processor set
- 请求的处理器集合中的处理器个数
- set
processor set membership of each CPU
OPTIONS
- -a
Aggregate output by processor set. Sort the output by set. The default output is sorted by CPU number.
The following options are supported:
- -p
Report processor set membership of each CPU. Sort the output by set. The default output is sorted by CPU number.
- -P set
Display only those processors in the specified set.
- -q
Suppress messages related to state changes.
- interval
Report once each interval seconds.
- 每次报告间隔的秒数
- count
Only print count reports.
- 只显示指定次数的报告
EXAMPLES
Example 1 Using mpstat to Generate User and System Operation Statistics
例1 使用mpstat产生用户和系统操作统计数据
The following command generates processor statistics over a five–second interval in two reports. The command shows the processor set membership of each CPU. The default output is sorted by CPU number, aggregated by processor set, for user (usr) and system (sys) operations. See the NOTES section for more information on wt time.
下面的命令以5秒的间隔产生了2个处理器的统计数据报告
example% mpstat -ap 5 2 |
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Availability | SUNWcsu |
Interface Stability | See below. |
Invocation is evolving. Human readable output is unstable.
SEE ALSO
NOTES
The sum of CPU utilization might vary slightly from 100 due to rounding errors in the production of a percentage figure.
CPU占用率的统计由于舍入错误,也许在百分比数字的总和略有不同
The total time used for CPU processing is the sum of usr and sys output values, reported for user and system operations. The wt value reports the time that processors are idle pending I/O operations. The idl value reports the time that the CPU is idle for any reason other than pending disk I/O operations. The total amount of idle CPU time is, therefore, the sum of wt and idl output values.
CPU处理的总时间是用户和系统操作报告的值usr和值sys的和
High wt times indicate problems in the disk subsystem, not problems with CPUs or other processing elements. Excessive wt times must be addressed by improving the performance, especially the service times, of the busiest disk devices. Run the iostat command with the -x option to report I/O service times in svc_t output. The iostat utility also reports the same wt, user (us), and system (sy) statistics. See iostat(1M) for more information.
wt的时间高意味着磁盘子系统的问题,不是CPU和其他部分的问
When executing in a zone and if the pools facility is active, mpstat(1M) will only provide information for those processors which are a member of the processor set of the pool to which the zone is bound.
当在一个zone里执行,如果pools facility处于活动状态,mpstat将只提供属于zone
个人体会:mpstat与其它统计工具一样,不能够仅靠一个工具