1. Top
The top command is a common performance analysis tool in Linux. It can display the resource usage of various processes in the system in real time, similar to the Windows Task Manager.
Description:
PID: process ID
User: process owner
PR: process priority. The smaller the value, the higher the execution priority.
Ninice: Value
Virt: Virtual Memory occupied by processes
Res: physical memory occupied by the Process
SHR: shared memory used by the Process
S: the status of the process. S indicates sleep, r indicates running, Z indicates frozen, and N indicates that the priority of the process is negative.
% CPU: CPU usage of processes
% Mem: Percentage of physical memory and total memory used by the Process
Time +: The total CPU time occupied by the process after it is started, that is, the accumulated value of the CPU usage time.
Command: Process startup command name
Common command: P: Ranking by % CPU usage
T: Ranking by mite +
M: ranked by % mem
2./proc/PID
Measure how much memory a process occupies. Linux provides us with a very convenient method. The/proc Directory provides us with all the information: /proc/n process whose PID is n
/Proc/n/cmdline process startup command
/Proc/n/CWD link to the current working directory of the process
/Proc/n/environ process environment variable list
/Proc/n/EXE link to the execution command file of the process
/Proc/n/FD contains all file descriptors RELATED TO THE PROCESS
/Proc/n/maps memory ing information related to processes
/Proc/n/MEM indicates the memory held by the process, which is not readable.
/Proc/n/root link to the root directory of the process
/Proc/n/STAT Process status
/Proc/n/statm process memory usage status
/Proc/n/Status Process status information, more readable than STAT/statm
/Proc/self link to the currently running process
3. The pmappmap command displays the number of memories used by one or more processes. You can use this tool to understand the memory allocated by a process on the server and determine whether this is the cause of memory bottleneck. For more detailed information, use the pmap-D option.