




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
TOP命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况。TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止.比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最“敏感”的任务列表.该命令可以按CPU使用.内存使用和执行时间对任务进行排序;而且该命令的很多特性都可以通过交互式命令或者在个人定制文件中进行设定. top - 12:38:33 up 50 days, 23:15,7 users,load average: 60.58, 61.14, 61.22Tasks: 203 total,60 running, 139 sleeping,4 stopped,0 zombieCpu(s): 27.0%us, 73.0%sy,0.0%ni,0.0%id,0.0%wa,0.0%hi,0.0%si,0.0%stMem:1939780k total,1375280k used,564500k free,109680k buffersSwap:4401800k total,497456k used,3904344k free,848712k cachedPID USERPRNIVIRTRESSHR S %CPU %MEMTIME+COMMAND4338 oracle250627m 209m 207m R0 11.0 297:14.76 oracle4267 oracle250626m 144m 143m R67.689:16.62 oracle3458 oracle250672m 133m 124m R07.11283:08 oracle3478 oracle250672m 124m 115m R06.61272:30 oracle3395 oracle250672m 122m 113m R06.51270:03 oracle3480 oracle250672m 122m 109m R86.41274:13 oracle3399 oracle250672m 121m 110m R06.41279:37 oracle4261 oracle250634m 100m99m R05.386:13.90 oracle25737 oracle250632m81m74m R04.3 272:35.42 oracle7072 oracle250626m72m71m R03.86:35.68 oracle16073 oracle250630m68m63m R83.6 175:20.36 oracle16140 oracle250630m66m60m R03.5 175:13.42 oracle16122 oracle250630m66m60m R03.5 176:47.73 oracle786 oracle250627m63m63m R03.41:54.93 oracle4271 oracle250627m59m58m R83.186:09.64 oracle4273 oracle250627m57m56m R83.084:38.20 oracle22670 oracle250626m50m49m R02.784:55.82 oracle一.TOP前五行统计信息统计信息区前五行是系统整体的统计信息。1.第一行是任务队列信息同uptime命令的执行结果:rootlocalhost # uptime13:22:30 up 8 min,4 users,load average: 0.14, 0.38, 0.25其内容如下:12:38:33当前时间up 50days系统运行时间,格式为时:分1 user当前登录用户数load average: 0.06, 0.60, 0.48系统负载,即任务队列的平均长度。三个数值分别为1分钟、5分钟、15分钟前到现在的平均值(这三个一般会小于1,如果持续高于5,请仔细查看那个程序影响系统的运行)。2.第二、三行为进程和CPU的信息当有多个CPU时,这些内容可能会超过两行。内容如下:Tasks: 29 total进程总数1 running正在运行的进程数28 sleeping睡眠的进程数0 stopped停止的进程数0 zombie僵尸进程数Cpu(s): 0.3% us用户空间占用CPU百分比1.0% sy内核空间占用CPU百分比0.0% ni用户进程空间内改变过优先级的进程占用CPU百分比98.7% id空闲CPU百分比0.0% wa等待输入输出的CPU时间百分比0.0% hiCPU服务于硬件中断所耗费的时间总额0.0% siCPU服务软中断所耗费的时间总额3.第四五行为内存信息。内容如下:Mem:191272k total物理内存总量173656k used使用的物理内存总量17616k free空闲内存总量22052k buffers用作内核缓存的内存量Swap:192772k total交换区总量0k used使用的交换区总量192772k free空闲交换区总量123988k cached缓冲的交换区总量。内存中的内容被换出到交换区,而后又被换入到内存,但使用过的交换区尚未被覆盖,该数值即为这些内容已存在于内存中的交换区的大小。相应的内存再次被换出时可不必再对交换区写入。二.进程信息列名含义PID进程idPPID父进程idRUSERReal user nameUID进程所有者的用户idUSER进程所有者的用户名GROUP进程所有者的组名TTY启动进程的终端名。不是从终端启动的进程则显示为?PR优先级NInice值。负值表示高优先级,正值表示低优先级P最后使用的CPU,仅在多CPU环境下有意义%CPU上次更新到现在的CPU时间占用百分比TIME进程使用的CPU时间总计,单位秒TIME+进程使用的CPU时间总计,单位1/100秒%MEM进程使用的物理内存百分比VIRT进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RESSWAP进程使用的虚拟内存中,被换出的大小,单位kb。RES进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATACODE可执行代码占用的物理内存大小,单位kbDATA可执行代码以外的部分(数据段+栈)占用的物理内存大小,单位kbSHR共享内存大小,单位kbnFLT页面错误次数nDRT最后一次写入到现在,被修改过的页面数。S进程状态。 D=不可中断的睡眠状态 R=运行 S=睡眠 T=跟踪/停止 Z=僵尸进程COMMAND命令名/命令行WCHAN若该进程在睡眠,则显示睡眠中的系统函数名Flags任务标志,参考sched.htop的man命令解释如下:Listed below are tops available fields.They are always associated with thelettershown,regardlessof the position you may have established for them with theo (Order fields) interactive command.Any field is selectable as the sort field, and you control whether they aresorted high-to-loworlow-to-high.Foradditionalinformation on sort provisions seetopic 3c. TASK Area Commands.a: PID-Process IdThe tasks unique process ID, which periodically wraps, though neverrestarting at zero.b: PPID-Parent Process PidThe process ID of a tasks parent.c: RUSER-Real User NameThe real user name of the tasks owner.d: UID-User IdThe effective user ID of the tasks owner.e: USER-User NameThe effective user name of the tasks owner.f: GROUP-Group NameThe effective group name of the tasks owner.g: TTY-Controlling TtyThename of the controlling terminal.This is usually the device (serial port, pty, etc.) from which the process was started, and which it usesforinputoroutput.However,a task need not be associated with a terminal, in which case youll see ? displayed.h: PR-PriorityThe priority of the task.i: NI-Nice valueThe nice value of the task.Anegativenicevaluemeanshigherpriority, whereasapositive nice value means lower priority.Zero in this field simply means priority will not be adjusted in determining a tasks dispatchability.j: P-Last used CPU (SMP)A number representing the last used processor.In a true SMPenvironmentthis will likely change frequently since the kernel intentionally uses weak affinity. Also, the very act of running top may break this weak affinityandcausemore processesto change CPUs more often (because of the extra demand for cpu time).k: %CPU-CPU usageThe tasks share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time.In a true SMP environment, if Irix mode is Off, top will operate in Solaris mode where a tasks cpu usage will be divided bythetotalnumberofCPUs.You toggle Irix/Solaris modes with the I interactive command.l: TIME-CPU TimeTotal CPU time the task has used since it started.WhenCumulativemodeis On,eachprocess is listed with the cpu time that it and its dead children has used.You toggle Cumulative mode with S, which is a command-line option and an interactive command.See the S interactive command for additional information regarding this mode.m: TIME+-CPU Time, hundredthsThe same as TIME, but reflecting more granularity through hundredths of a second.n: %MEM-Memory usage (RES)A tasks currently used share of available physical memory.o: VIRT-Virtual Image (kb)The total amount of virtual memory used by the task.It includes all code, data and shared libraries plus pages that havebeenswappedout.(Note:youcan definethe STATSIZE=1 environment variable and the VIRT will be calculated from the /proc/#/state VmSize field.)VIRT = SWAP + RES.p: SWAP-Swapped size (kb)The swapped out portion of a tasks total virtual memory image.q: RES-Resident size (kb)The non-swapped physical memory a task has used.RES = CODE + DATA.r: CODE-Code size (kb)The amount of physical memory devoted to executablecode,alsoknownasthetext resident set size or TRS.s: DATA-Data+Stack size (kb)Theamount of physical memory devoted to other than executable code, also known the data resident set size or DRS.t: SHR-Shared Mem size (kb)The amount of shared memory used by a task.Itsimplyreflectsmemorythat could be potentially shared with other processes.u: nFLT-Page Fault countThenumberofmajorpage faults that have occurred for a task.A page fault occurs when a process attempts to read from or write to a virtual pagethatis notcurrentlypresentinits address space.A major page fault is when disk access is involved in making that page available.v: nDRT-Dirty Pages countThe number of pages that have been modified sincetheywerelastwrittento disk.Dirtypagesmustbe written to disk before the corresponding physical memory location can be used for some other virtual page.w: S-Process StatusThe status of the task which can be one of:D = uninterruptible sleepR = runningS = sleepingT = traced or stoppedZ = zombieTasks shown as running should be more properly thought of as ready to run-theirtask_struct is simply represented on the Linux run-queue.Even without a true SMP machine, you may see numerous tasks in this statedependingontops delay interval and nice value.x: Command-Command line or Program nameDisplay the command line used to start a task or the name of the associated program.You toggle between command line and name with c, which is bothacommand-line option and an interactive command. Whenyouvechosento display command lines, processes without a command line (like kernel threads) will be shown with only the program nameinparentheses, as in this example:( mdrecoveryd ) Eitherformofdisplay is subject to potential truncation if its too long to fit in this fieldscurrentwidth.Thatwidthdependsuponotherfieldsselected, their order and the current screen width.Note: The Command field/column is unique, in that it is not fixed-width.When displayed, this column will be allocated all remaining screen width (uptothe maximum512characters)toprovide for the potential growth of program names into command lines.y: WCHAN-Sleeping in FunctionDepending on the availability of the kernel link map (System.map), thisfield willshowthename or the address of the kernel function in which the task is currently sleeping.Running tasks will display a dash (-) in this column.Note: By displaying this field, tops own working set will be increased byover 700Kb.Youronlymeans of reducing that overhead will be to stop and restarttop.z: Flags-Task FlagsThis column represents the tasks current scheduling flags whichareexpressed inhexadecimalnotation and with zeros suppressed.These flags are officially documented in .Less formal documentation can also befoundon the Fields select and Order fields screens.默认情况下仅显示比较重要的PID、USER、PR、NI、VIRT、RES、SHR、S、%CPU、%MEM、TIME+、COMMAND列。2.1用快捷键更改显示内容。(1)更改显示内容通过f键可以选择显示的内容。按f键之后会显示列的列表,按a-z即可显示或隐藏对应的列,最后按回车键确定。(2)按o键可以改变列的显示顺序。按小写的a-z可以将相应的列向右移动,而大写的A-Z可以将相应的列向左移动。最后按回车键确定。按大写的F或O键,然后按a-z可以将进程按照相应的列进行排序。而大写的R键可以将当前的排序倒转。设置完按回车返回界面。三.命令使用详细内容可以参考MAN帮助文档。这里列举部分内容:命令格式:top - d p q c C Sn参数说明:d:指定每两次屏幕信息刷新之间的时间间隔。当然用户可以使用s交互命令来改变之。p:通过指定监控进程ID来仅仅监控某个进程的状态。q:该选项将使top没有任何延迟的进行刷新。如果调用程序有超级用户权限,那么top将以尽可能高的优先级运行。S:指定累计模式s:使top命令在安全模式中运行。这将去除交互命令所带来的潜在危险。i:使top不显示任何闲置或者僵死进程。c:显示整个命令行而不只是显示命令名在top命令的显示窗口,我们还可以输入以下字母,进行一些交互:帮助文档如下:Help for Interactive Commands - procps version 3.2.7Window 1:Def: Cumulative mode Off.System: Delay 4.0 secs; Secure mode Off.Z,BGlobal: Z change color mappings; B disable/enable boldl,t,mToggle Summaries: l load avg; t task/cpu stats; m mem info1,IToggle SMP view: 1 single/separate states; I Irix/Solaris modef,o. Fields/Columns: f add or remove; o change display orderF or O. Select sort field. Move sort field: next col rightR,H. Togg
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年公共管理职位面试模拟题及答案深度解析
- 2025年供销社农资配送中心招聘面试题难点解析及应对方法
- 拉弯机安全培训课件
- 2025年大数据展现平台合作协议书
- 抢救知识培训课件
- 2025年家用厨房电器具项目发展计划
- 2025年重组抗原诊断试剂项目建议书
- 2025年石英玻璃纤维套管项目合作计划书
- 抗菌素使用课件
- 高2024级2025年秋期开学考试地理试题
- 营养性维生素缺乏性佝偻病
- Fluke125示波器培训教材
- GB/T 30559.2-2017电梯、自动扶梯和自动人行道的能量性能第2部分:电梯的能量计算与分级
- GA 668-2006警用防暴车通用技术条件
- 《C语言程序设计》一等奖说课稿
- (四级)劳动关系协调员理论备考题库(新600题)
- 油画综合材料与技法
- 血浆置换 (1)课件
- 测量教案5章-es-602g全站仪
- 液压与气压传动技术全套课件
- 洗煤厂安全安全生产岗位责任制(很全)
评论
0/150
提交评论