linux top详解.docx

上传人:b****6 文档编号:3973976 上传时间:2022-11-26 格式:DOCX 页数:10 大小:22.32KB
下载 相关 举报
linux top详解.docx_第1页
第1页 / 共10页
linux top详解.docx_第2页
第2页 / 共10页
linux top详解.docx_第3页
第3页 / 共10页
linux top详解.docx_第4页
第4页 / 共10页
linux top详解.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

linux top详解.docx

《linux top详解.docx》由会员分享,可在线阅读,更多相关《linux top详解.docx(10页珍藏版)》请在冰豆网上搜索。

linux top详解.docx

linuxtop详解

TOP命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况。

TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止.比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最“敏感”的任务列表.该命令可以按CPU使用.内存使用和执行时间对任务进行排序;而且该命令的很多特性都可以通过交互式命令或者在个人定制文件中进行设定.

top-12:

38:

33up50days,23:

15,  7users,  loadaverage:

60.58,61.14,61.22

Tasks:

203total,  60running,139sleeping,   4stopped,   0zombie

Cpu(s)  :

27.0%us,73.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:

   1939780ktotal,  1375280kused,   564500kfree,   109680kbuffers

Swap:

  4401800ktotal,   497456kused,  3904344kfree,   848712kcached

PIDUSER  PR  NI  VIRT  RES  SHRS%CPU%MEM    TIME+  COMMAND                                

 4338oracle    25   0  627m209m207mR    011.0297:

14.76oracle                                

 4267oracle    25   0  626m144m143mR    6  7.6  89:

16.62oracle                                

 3458oracle    25   0  672m133m124mR    0  7.1   1283:

08oracle                                

 3478oracle    25   0  672m124m115mR    0  6.6   1272:

30oracle                                

 3395oracle    25   0  672m122m113mR    0  6.5   1270:

03oracle                                 

 3480oracle    25   0  672m122m109mR    8  6.4   1274:

13oracle                                

 3399oracle    25   0  672m121m110mR    0  6.4   1279:

37oracle                                

 4261oracle    25   0  634m100m  99mR    0  5.3  86:

13.90oracle                                

25737oracle    25   0  632m  81m  74mR    0  4.3272:

35.42oracle                                

 7072oracle    25   0  626m  72m  71mR    0  3.8   6:

35.68oracle                                

16073oracle    25   0  630m  68m  63mR    8  3.6175:

20.36oracle                                

16140oracle    25   0  630m  66m  60mR    0  3.5175:

13.42oracle                                

16122oracle    25   0  630m  66m  60mR    0  3.5176:

47.73oracle                                

  786oracle    25   0  627m  63m  63mR    0  3.4   1:

54.93oracle                                

 4271oracle    25   0  627m  59m  58mR    8  3.1  86:

09.64oracle                                

 4273oracle    25   0  627m  57m  56mR    8  3.0  84:

38.20oracle                                

22670oracle    25   0  626m  50m  49mR    0  2.7  84:

55.82oracle     

一.  TOP前五行统计信息

统计信息区前五行是系统整体的统计信息。

1. 第一行是任务队列信息

同 uptime  命令的执行结果:

[root@localhost~]#uptime

 13:

22:

30up8min,  4users,  loadaverage:

0.14,0.38,0.25

其内容如下:

12:

38:

33

当前时间

up50days

系统运行时间,格式为时:

1user

当前登录用户数

loadaverage:

0.06,0.60,0.48

系统负载,即任务队列的平均长度。

 三个数值分别为  1分钟、5分钟、15分钟前到现在的平均值(这三个一般会小于1,如果持续高于5,请仔细查看那个程序影响系统的运行)。

2. 第二、三行为进程和CPU的信息

当有多个CPU时,这些内容可能会超过两行。

内容如下:

Tasks:

29total

进程总数

1running

正在运行的进程数

28sleeping

睡眠的进程数

0stopped

停止的进程数

0zombie

僵尸进程数

Cpu(s):

0.3%us

用户空间占用CPU百分比

1.0%sy

内核空间占用CPU百分比

0.0%ni

用户进程空间内改变过优先级的进程占用CPU百分比

98.7%id

空闲CPU百分比

0.0%wa

等待输入输出的CPU时间百分比

0.0%hi

CPU服务于硬件中断所耗费的时间总额

0.0%si

CPU服务软中断所耗费的时间总额

3. 第四五行为内存信息。

内容如下:

Mem:

 191272ktotal

物理内存总量

173656kused

使用的物理内存总量

17616kfree

空闲内存总量

22052kbuffers

用作内核缓存的内存量

Swap:

 192772ktotal

交换区总量

0kused

使用的交换区总量

192772kfree

空闲交换区总量

123988kcached

缓冲的交换区总量。

 内存中的内容被换出到交换区,而后又被换入到内存,但使用过的交换区尚未被覆盖, 该数值即为这些内容已存在于内存中的交换区的大小。

相应的内存再次被换出时可不必再对交换区写入。

二.  进程信息

列名

含义

PID

进程id

PPID

父进程id

RUSER

Realusername

UID

进程所有者的用户id

USER

进程所有者的用户名

GROUP

进程所有者的组名

TTY

启动进程的终端名。

不是从终端启动的进程则显示为 ?

PR

优先级

NI

nice值。

负值表示高优先级,正值表示低优先级

P

最后使用的CPU,仅在多CPU环境下有意义

%CPU

上次更新到现在的CPU时间占用百分比

TIME

进程使用的CPU时间总计,单位秒

TIME+

进程使用的CPU时间总计,单位1/100秒

%MEM

进程使用的物理内存百分比

VIRT

进程使用的虚拟内存总量,单位kb。

VIRT=SWAP+RES

SWAP

进程使用的虚拟内存中,被换出的大小,单位kb。

RES

进程使用的、未被换出的物理内存大小,单位kb。

RES=CODE+DATA

CODE

可执行代码占用的物理内存大小,单位kb

DATA

可执行代码以外的部分(数据段+栈)占用的物理内存大小,单位kb

SHR

共享内存大小,单位kb

nFLT

页面错误次数

nDRT

最后一次写入到现在,被修改过的页面数。

S

进程状态。

        D=不可中断的睡眠状态

        R=运行

        S=睡眠

        T=跟踪/停止

        Z=僵尸进程

COMMAND

命令名/命令行

WCHAN

若该进程在睡眠,则显示睡眠中的系统函数名

Flags

任务标志,参考 sched.h

top 的man 命令解释如下:

    Listedbelowaretop'savailablefields.  Theyarealwaysassociatedwiththe  letter  shown,  regardless  ofthepositionyoumayhaveestablishedforthemwiththe 'o'(Orderfields)interactivecommand.Anyfieldisselectableasthesortfield,andyoucontrolwhethertheyare  sortedhigh-to-low  or  low-to-high.   For  additional  informationonsortprovisionssee  topic3c.TASKAreaCommands.

a:

PID  --  ProcessId

       Thetask'suniqueprocessID,whichperiodicallywraps,thoughnever  restartingatzero.

b:

PPID  --  ParentProcessPid

       TheprocessIDofatask'sparent.

c:

RUSER  --  RealUserName

       Therealusernameofthetask'sowner.

d:

UID  --  UserId

       TheeffectiveuserIDofthetask'sowner.

e:

USER  --  UserName

       Theeffectiveusernameofthetask'sowner.

f:

GROUP  --  GroupName

       Theeffectivegroupnameofthetask'sowner.

g:

TTY  --  ControllingTty

       The  nameofthecontrollingterminal.  Thisisusuallythedevice(serialport,pty,etc.)fromwhichtheprocesswasstarted,andwhichituses  for  input  oroutput.   However,  ataskneednotbeassociatedwithaterminal,inwhichcaseyou'llsee'?

'displayed.

h:

PR  --  Priority

       Thepriorityofthetask.

i:

NI  --  Nicevalue

       Thenicevalueofthetask.   A  negative  nice  value  means  higher  priority,whereas  a  positivenicevaluemeanslowerpriority.  Zerointhisfieldsimplymeansprioritywillnotbeadjustedindeterminingatask'sdispatchability.

j:

P  --  LastusedCPU(SMP)

       Anumberrepresentingthelastusedprocessor.  InatrueSMP  environment  thiswilllikelychangefrequentlysincethekernelintentionallyusesweakaffinity.Also,theveryactofrunningtopmaybreakthisweakaffinity  and  cause  moreprocesses  tochangeCPUsmoreoften(becauseoftheextrademandforcputime).

k:

%CPU  --  CPUusage

       Thetask'sshareoftheelapsedCPUtimesincethelastscreenupdate,expressedasapercentageoftotalCPUtime.  InatrueSMPenvironment,if'Irixmode'isOff,topwilloperatein'Solarismode'whereatask'scpuusagewillbedividedby  the  total  number  of  CPUs.   Youtoggle'Irix/Solaris'modeswiththe'I'interactivecommand.

l:

TIME  --  CPUTime

       TotalCPUtimethetaskhasusedsinceitstarted.  When  'Cumulative  mode'  isOn,  each  processislistedwiththecputimethatitanditsdeadchildrenhasused.  Youtoggle'Cumulativemode'with'S',whichisacommand-lineoptionandaninteractivecommand.  Seethe'S'interactivecommandforadditionalinformationregardingthismode.

m:

TIME+  --  CPUTime,hundredths

       Thesameas'TIME',butreflectingmoregranularitythroughhundredthsofasec          ond.

n:

%MEM  --  Memoryusage(RES)

       Atask'scurrentlyusedshareofavailablephysicalmemory.

o:

VIRT  --  VirtualImage(kb)

       Thetotalamountofvirtualmemoryusedbythetask.  Itincludesallcode,dataandsharedlibrariespluspagesthathave  been  swapped  out.  (Note:

  you  candefine  theSTATSIZE=1environmentvariableandtheVIRTwillbecalculatedfromthe/proc/#/stateVmSizefield.)

       VIRT=SWAP+RES.

p:

SWAP  --  Swappedsize(kb)

       Theswappedoutportionofatask'stotalvirtualmemoryimage.

q:

RES  --  Residentsize(kb)

       Thenon-swappedphysicalmemoryataskhasused.

       RES=CODE+DATA.

r:

CODE  --  Codesize(kb)

       Theamountofphysicalmemorydevotedtoexecutable  code,  also  known  as  the'textresidentset'sizeorTRS.

s:

DATA  --  Data+Stacksize(kb)

       The  amountofphysicalmemorydevotedtootherthanexecutablecode,alsoknownthe'dataresidentset'sizeorDRS.

t:

SHR  --  SharedMemsize(kb)

       Theamountofsharedmemoryusedbyatask.   It  simply  reflects  memory  thatcouldbepotentiallysharedwithotherprocesses.

u:

nFLT  --  PageFaultcount

       The  number  of  major  pagefaultsthathaveoccurredforatask.  Apagefaultoccurswhenaprocessattemptstoreadfromorwritetoavirtualpage  that  isnot  currently  present  in  itsaddressspace.  Amajorpagefaultiswhendiskaccessisinvolvedinmakingthatpageavailable.

v:

nDRT  --  DirtyPagescount

       Thenumberofpagesthathavebeenmodifiedsince  they  were  last  written  todisk.   Dirty  pages  must  bewrittentodiskbeforethecorrespondingphysicalmemorylocationcanbeusedforsomeothervirtualpage.

w:

S  --  ProcessStatus

       Thestatusofthetaskwhichcanbeoneof:

             'D'=uninterruptiblesleep

             'R'=running

             'S'=sleeping

             'T'=tracedorstopped

             'Z'=zombie

       Tasksshownasrunningshouldbemoreproperlythoughtofas'readytorun'  --their  task_structissimplyrepresentedontheLinuxrun-queue.  EvenwithoutatrueSMPmachine,youmayseenumeroustasksinthisstate  depending  on  top'sdelayintervalandnicevalue.

x:

Command  --  CommandlineorProgramname

       Displaythecommandlineusedtostartataskorthenameoftheassociatedprogram.  Youtogglebetweencommandlineandnamewith'c',whichisboth  a  command-lineoptionandaninteractivecommand.When  you've  chosen  todisplaycommandlines,processeswithoutacommandline(likekernelthreads)willbeshownwithonlytheprogramname  in  parentheses,asinthisexample:

                (mdrecoveryd)Either  form  of  displayissubjecttopotentialtruncationifit'stoolongtofitinthisfield's  current  width.   That  width  depends  upon  other  fields  selected,theirorderandthecurrentscreenwidth.

       Note:

The'Command'field/columnisunique,inthatitisnotfixed-width.  Whe

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 小学教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1