|
-c event counting :
| a ccumulative ,
d elta. (relative to previous sample),
e Absolute n on-event (default). CPU usage since previous sample. -l nsamples logging mode in raw form.
| -L |
Command line options are processed from left to right.
If conflicting options are specified, later specifications overrides .
making it
viable to create a shell alias for top with preferred defaults , then override those preferred defaults as desired on the command line.
The first several lines show the global state.
CPU | Percentage of processor usage, broken into user, system, and idle components. | ||
Disks | reads and writes. | ||
LoadAvg | over 1, 5, and 15 minutes. | ||
MemRegions | Number and total size of memory regions, and total size of memory regions broken into private (broken into non-library and library) and shared components. | ||
Networks | packets. | ||
PhysMem | wired, active, inactive, used, and free components. | ||
Procs | Total number of processes and number of processes in each process state. | ||
SharedLibs | Number of shared libraries, resident sizes of code and data segments, and link editor memory usage. | ||
Threads .
| |||
Time |
COW_FAULTS |
^G
escapes the interactive argument prompt and is the same as leaving the input field blank and pressing enter.
other Keypresses cause a sample update.
^L | Redraw the screen. | ||||
cmode | a ccumulative , d elta, e vent, n on-event mode.
| ||||
sdelay | |||||
n Only display | okey | sort on key in descending order. | + ascending - descending
Oskey skey | secondary key
| |
command
| |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cpu
| |||||||||||||||||||||||||||
pid
| |||||||||||||||||||||||||||
prt | Number of Mach ports. | ||||||||||||||||||||||||||
reg | Number of memory regions. | ||||||||||||||||||||||||||
rprvt | Resident private address space size. | ||||||||||||||||||||||||||
rshrd | Resident shared | ||||||||||||||||||||||||||
vprvt | Private | ||||||||||||||||||||||||||
rsize | Resident memory size. | ||||||||||||||||||||||||||
th | Number of threads. | ||||||||||||||||||||||||||
time | Execution time. | ||||||||||||||||||||||||||
vsize | Total memory size. | ||||||||||||||||||||||||||
uid
| |||||||||||||||||||||||||||
username
| |||||||||||||||||||||||||||
toggles | |||||||||||||||||||||||||||
f | frameworks | ||||||||||||||||||||||||||
r | recursive (traversal)of the memory object map for each process. | ||||||||||||||||||||||||||
t | translation of uid numbers to usernames. | ||||||||||||||||||||||||||
UOnly display processes owned by | w | wide/narrow delta
| x | deprecated/normal
| S signal pid | a number or as a name (for example, | INT, HUP ).
Default TERM. Each time a signal is successfully sent, the default signal is updated to be that signal.
q
| ?
| deprecated-
| -a | use -ca.
| -d | use -cd.
| -e | use -ce.
| -k | memory object reporting for process 0 (kernel_task), default.
| -u | use -ocpu -Otime.
| |
top -ocpu -O+rsize -s 5 -n 20 Sort the processes according to CPU usage (descending) and sOresident memory size (ascending), update every 5 seconds and limit to 20 processes. |
top -ce # Run top in event counter mode.
|
top -tl 10
|
See htop, kill, vm_stat, signal
from BSD Apple darwin 7.9.0
Each version of *nix has their own implementaition of top .This document reflects Apple Mac OS X El Captian.
Periodically displays a list of system processes. The default sorting key is
Options are processed from left to right. For repeated options: later specifications override earlier ones.
DISPLAYprio / nice is not displayed! (see ps -o nice -o pri The first several lines of show global state.
Below the global state fields, a list of processes is displayed.
InteractionCommands are one character, arguments are prompted for, (default shown in brackets), selected by pressing enter.c mode o key sorting on key prefix + ascending or - descending. O skey skey is secondary key r Toggle traversal and reporting of the memory object map for each process. S signal pid Send sig to pid default starts out as TERM . Each time a signal is sent, the default signal is updated to be that signal. sdelay between updates Uuser Only display processes owned by user. Either the username or uid number ? Display the help screen. ^L Redraw the screen. q Quit. To display all processes, press enter
PERFORMANCE vs. ACCURACYCalculating detailed memory statistics is resource-intensive. To minimize the cpu usage stats are updated every 10 samples.-i 1 will result in the most accurate display, at the expense of
system resources.
EXAMPLESSort the processes according to
top -o cpu -O +rsize -s 5 -n 20Run top in delta mode. top -c dDisplay only the specified statistics, regardless of width chage of the terminal. If too narrow, only the statistics that fit will be displayed. top -stats pid,command,cpu,th,pstate,time |
smac14 .zsh_sessions % brew install htop Running `brew update --auto-update`... ==> Auto-updated Homebrew! ==> Fetching dependencies for htop: ncurses ==> Fetching ncurses ==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.3 ####################### 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/blobs/sha256: ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256: ####################### 100.0% ==> Fetching htop ==> Downloading https://ghcr.io/v2/homebrew/core/htop/manifests/3.2.1 smac14 .zsh_sessions % brew install htop Running `brew update --auto-update`... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Fetching dependencies for htop: ncurses ==> Fetching ncurses ==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.3 ==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/blobs/sha256:xx ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:xx ==> Fetching htop ==> Downloading https://ghcr.io/v2/homebrew/core/htop/manifests/3.2.1 ==> Downloading https://ghcr.io/v2/homebrew/core/htop/blobs/sha256:xx ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:xx ==> Installing dependencies for htop: ncurses ==> Installing htop dependency: ncurses ==> Pouring ncurses--6.3.arm64_ventura.bottle.tar.gz /opt/homebrew/Cellar/ncurses/6.3: 3,968 files, 9.6MB ==> Installing htop ==> Pouring htop--3.2.1.arm64_ventura.bottle.tar.gz ==> Caveats htop requires root privileges to correctly display all running processes,
% sudo htop 0[|||||||| 10.5%] 4[ 0.0%] 1[|||||| 8.6%] 5[ 0.0%] 2[|||| 4.7%] 6[ 0.0%] 3[|| 2.0%] 7[ 0.0%] Mem[|||||||||||||||||||||||||||||| 8.13G/32.0G] Tasks: 579, 2074 thr, 0 kthr; 1 running Swp[ 0K/0K] Load average: 1.46 1.41 1.45 Uptime: 2 days, 10:32:24 [Setup] Categories Header Layout Display options [x] 2 columns - 50/50 (default) Header layout [ ] 2 columns - 33/67 Meters [ ] 2 columns - 67/33 Screens [ ] 3 columns - 33/34/33 Colors [ ] 3 columns - 25/25/50 [ ] 3 columns - 25/50/25 [ ] 3 columns - 50/25/25 [ ] 3 columns - 40/20/40 [ ] 4 columns - 25/25/25/25 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10Done