-c event counting :
| a ccumulative ,
d elta. (relative to previous sample),
e Absolute n on-event (default). CPU usage since previous sample.logging mode in raw form.
| -L | non-logging i.e. interactive
| -n nprocs
| -o key | sort on key in descending order. | + prefixed ascending, - descending
-O skey | secondary sort key |
pid Process ID (default). prt Number of Mach ports. reg Number of memory regions. rprvt Resident private address space size. rshrd Resident shared address space size. rsize Resident memory size. th Number of threads. time Execution time. uid User ID. username vprvt Private address space size. vsize Total memory size. -r | recursively traverse and report the memory object map for each process (default).
| -R | not recursive . This substantially reduces the amount of processor time top consumes.
| -s secs | seed of updates
| -t | Translate uid numbers to usernames.
| -T | Do not " "
| -U user | Only display processes owned by var> | username or uid -F | omitt frameworks(i.e. shared libraries) substantially reduces processor time top consumes.
| -f | include shared libraries(default).
| |
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 in accumulative event counting mode, the time since top started is printed in parentheses
VirtMem
Total virtual memory, virtual memory consumed by shared libraries, and number of pageins and pageouts.
COW_FAULTS |
other Keypresses cause a sample update.
^L Redraw the screen. | ||||||||||||||||||||||||||||||||||||||||
cmode a ccumulative , d elta, e vent, n on-event mode.
| ||||||||||||||||||||||||||||||||||||||||
sdelay | ||||||||||||||||||||||||||||||||||||||||
n okey sort on key in descending order. | + ascending - descending
Oskey skey secondary key
|
toggles
| f | frameworks
| r | recursive (traversal)of the memory object map for each process.
| t | translation of uid numbers to usernames.
| U | nly 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 used to turn on memory object reporting for process 0 (kernel_task), but this is now done by 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.
top [-a | -d | -e | -c mode]
[-F | -f]
[-h]
[-i interval]
[-l samples]
[-ncols columns]
[-o key] [-O
[-R | -r]
[-S]
[-s delay]
[-n nprocs]
[-stats keys]
[-pid processid]
[-user username]
[-U username]
[-u]
Periodically displays a list of system processes. The default sorting key is pid
Option specifications are processed from left to right. For repeated options: later specifications override earlier ones. This makes it viable to create a shell alias for top with preferred defaults then override those preferred defaults as desired on the command line.
-c mode |
ps -o nice -o pri
Procs |
Below the global state fields, a list of processes is displayed. The pid field displays the following for the architecture: + for 64-bit native or - for 32-bit native or * for a non-native .
INTERACTION
Each command is one character, arguments are prompted for, (default shown in brackets), selected by pressing enter.
? Display the help screen.
^L Redraw the screen.
c mode
o key sorting on key A + or - prefix ascending or descending
O skey skey is secondary key
q Quit.
r Toggle traversal and reporting of the memory object map for each process.
S signal pid Send sig
to pid
The default signal starts out as TERM
. Each time a signal is successfully 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
To display all processes, press enter
-i 1
will result in the most accurate display, at the expense of
system resources.
N/A - Not Available: Caused by the memory object map reporting being disabled. (default in delta mode)
, but may be enabled via -r
or the interactive r
command after any -c
top -o cpu -O +rsize -s 5 -n 20Run top in delta mode.
top -c dDisplay only the specified statistics, regardless of any growth of the terminal. If the terminal is too small, only the statistics that fit will be displayed.
top -stats pid,command,cpu,th,pstate,time