Top: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 35: Line 35:
* <span id='VIRT'></span>VIRT: [[Linux_Memory_Management#Virtual_Size_of_a_Process|virtual size of the process]].
* <span id='VIRT'></span>VIRT: [[Linux_Memory_Management#Virtual_Size_of_a_Process|virtual size of the process]].
* <span id='RES'></span>RES: [[Linux_Memory_Management#Resident_Size_of_a_Process|resident size of the process]].
* <span id='RES'></span>RES: [[Linux_Memory_Management#Resident_Size_of_a_Process|resident size of the process]].
* <span id='SHR'></span>SHR: [[Linux_Memory_Management#Shareable_Size_of_a_Process|shareable size of the process]].


=Linux=
=Linux=

Latest revision as of 03:25, 29 December 2020

Internal

Overview

Display per host/VM/container information and per process information.

top - 14:44:47 up 4 min,  1 user,  load average: 0.00, 0.01, 0.01
Tasks:  87 total,   2 running,  85 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.5 us,  0.5 sy,  0.0 ni, 98.8 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1017160 total,   787000 free,    88844 used,   141316 buff/cache
KiB Swap:  1048572 total,  1048572 free,        0 used.   793204 avail Me

PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
1   root      20   0  201660   3932   2412 S  0.0  0.4   0:00.48 systemd
2   root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd

The memory summary line ("KiB Mem") refers to the entire host/VM/container, as follows:

The relationship between the values described above is given by the formula:

total = free + used + buff/cache

The metrics per process are:

Linux

Batch Mode

Run "top" in batch mode, just one iteration:

top -b -n 1

Only summary information (and one process for PID 0)

top -b -n 1 -p 0

Mac

Batch Mode

Specify one sample:

top -l 1

-l logging mode.

Get stats only for specific keys: -o <key>, where keys: ...

-n <nprocs> display only up to nprocs. 0 works, it only displays the system-wide stats.

top -l 1 -n 0