top

 

 

 


Parameters

 

top -v          # check version

 

-d N            # interval

-e k             # memory to be scaled as:
                   # k - kibibytes(default); m - mebibytes

-p                 # Monitor PID (e.g. -pN1 -pN2)

-u n/name    # Display only processes with a user id / name
                      (top -u '!root' 代表 non-root process)

 


Summary area fields

 

頭頂那部份就是 Summary area

%Cpu(s):

%Cpu(s):  3.4 us,  8.6 sy,  0.0 ni, 28.9 id, 56.9 wa0.0 hi,  2.2 si,  0.0 st

Describing CPU statistics are abbreviated

The 3 CPU states

  • Idle
  • Running in user mode
  • Running in kernel mode

解釋:

us = user mode
sy = system mode
ni = the CPU spent running user space processes that have been niced (nice)
id = idle task (如果 cpu 無野做, 那會 99%)
wa = I/O waiting (reading or writing to a disk)

hi = servicing IRQs
si = servicing soft IRQs

st = steal (time given to other DomU instances)
       ( How long the virtual CPU has spent waiting for the hypervisor to service another virtual CPU )

 


Sorting

 

To sort by parameter (-o)

-o field

Field: %CPU, %MEM, PID, RES, TIME, SWAP

A leading "+" will force sorting high to low (Default). A "-" will low to high ordering

e.g.

top -o +%CPU

top -o +%MEM

Interactive Commands

Hotkey

x <- Highlight column you are currently sorting by

Sort by X

Default 由大至細 sort

P = shift + p 

  • P: CPU usage
  • M: memory (%MEM) usage
  • T: running-time(TIME+)
  • N: PID

Notes

Reverse sorting: R

 

 

 

Creative Commons license icon Creative Commons license icon