This article is collected on GitHub DailyQuestion: DailyQuestion, including big factory promotion opportunity, interview book and several interview questions, study 5 minutes a day, a year to enter the big factory.
- Dachang Face Sutra
- Big push
Ps lets you know how much memory a process occupies
$ ps -O rss -p 3506
PID RSS S TTY TIME COMMAND
3506 6984 S pts/1 00:00:00 vim
Copy the code
If you want to monitor memory, be sure to use the process-all-purpose pidstat command (PS: the name sounds obvious)
-r Displays memory information
# -p Specifies the PID
# 1: Print once every second$pidstat -r -p 3506 1 Linux 3.10.0-957.21.3.el7.x86_64 (shanyue) 11/04/19_x86_64_ (2 CPU) 20:47:35 UID PID minflt/s Majflt /s VSZ RSS %MEM Command 20:47:360 0 3506 0.00 0.00 139940 6984 0.18 vim 20:47:370 0 3506 0.00 0.00 139940 6984 0.18 Vim 20:47:350 0.00 0.00 139940 6984 0.18 vim 20:47:350 0.00 0.00 0.00 139940 6984 0.18 vim 20:47:41 0 3506 0.00 0.00 139940 6984 0.18 vimCopy the code
Pidstat is a Linux performance tool under SYSstat, but how do you locate memory changes on the MAC? You can use the all-purpose top/ hTOP
$ htop -p 31796
Copy the code
conclusion
In short, there are three commands
pidstat -r
htop/top -p
ps -O rss -p
For more information about monitoring metrics, see my article: Linux Monitoring Metrics Notes
Pay attention to my
Scan code to add my wechat, remarks into the group, join the advanced front-end advanced group